marshal doesn't work with "file-like" objects

echuck at mindspring.com echuck at mindspring.com
Sun Jan 28 00:18:39 EST 2001


In article <Wyxc6.9225$AH6.1522817 at newsc.telia.net>,
  "Fredrik Lundh" <fredrik at effbot.org> wrote:
> Chuck wrote:
> > Does anyone really believe that there is any difference in
performance?
> > Supporting file-like objects would add the overhead of a message
pass.
>
> "a couple of thousand message passes", that is.
>
> > But what's taking place here is file I/O that easily ranges from 1K
to
> > 40K (according to my dir *.pyc).
>
> marshal does lots of single byte reads.  the're only one fread
> in marshal, and that's used to read string literals.
>
> > I seriously doubt that if message passing were suddenly employed [a]
> > anyone would notice and [b] any Python benchmarks would change.
>
> maybe, but people sure notice when we *improved* marshal's
> performance:
>
>     http://deja.com/=dnc/getdoc.xp?AN=715125331
>
> > I win <0.95 wink>.
>
> nope.
>
> Cheers /F


OK, here's my next attempt:

It would be even faster to simply write the marshal results to memory
first and then blast them out to disk in one fell swoop, e.g.
ultimately one fprintf() call.

In which case, my original thought that a single message pass wouldn't
matter becomes correct.

Sound good?


-Chuck


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list