Implementing file reading in C/Python

James Mills prologic at shortcircuit.net.au
Thu Jan 8 23:29:46 EST 2009


On Fri, Jan 9, 2009 at 3:13 PM, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> Uhh, yes, you're right there... I must admit that I was too lazy to
> include all the stat headers and to a proper st_size check in the C
> version (just a quick hack), so it's practically hardcoded.
>
> With files of exactly 2GB in size the results should be the same (more
> or less, +- 1 line doesn't matter really), because 2 GB / 2048 (the
> buffer) = 1 Million.
>
> Sorry I didn't mention that, it was really kind of sloppy,
> quick-and-dirty C writing on my part. But you're right, the Python
> implementation does what is actually supposed to happen.

I shall attempt to optimize this :)
I have  a funny feeling you might be caught up with
some features of Python - one notable one being that
some things in Python are immutable.

psyco might help here though ...

cheers
James



More information about the Python-list mailing list