file seek is slow

Neil Hodgson nyamatongwe+thunder at
Thu Mar 11 00:01:05 CET 2010


> As it turns out each call is only
> 646 nanoseconds slower than 'C'.
> However, that is still 80% of the time to perform a file seek,
> which I would think is a relatively slow operation compared to just
> making a system call.

   A seek may not be doing much beyond setting a current offset value.
It is likely that fseek(f1, 0, SEEK_SET) isn't even doing a system call.

   An implementation of fseek will often return relatively quickly when
the position is within the current buffer -- from line 192 in


More information about the Python-list mailing list