cPickle.load vs. file.read+cPickle.loads on large binary files

Chris Angelico rosuav at gmail.com
Tue Nov 17 10:20:04 EST 2015


On Wed, Nov 18, 2015 at 1:20 AM,  <andrea.gavana at gmail.com> wrote:
> Thank you for your answer. I do get similar timings when I swap the two functions, and specifically still 15 seconds to read the file via file.read() and 2.4 seconds (more or less as before) via cPickle.load(fid).
>
> I thought that the order of operations might be an issue but apparently that was not the case...

What if you call one of them twice and then the other? Just trying to
rule out any possibility that it's a caching problem.

On my Linux box, running 2.7.9 64-bit, the two operations take roughly
the same amount of time (1.8 seconds for load vs 1s to read and 0.8 to
loads). Are you able to run this off a RAM disk or something?

Most curious.

ChrisA



More information about the Python-list mailing list