Metalone: > 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 http://www.google.com/codesearch/p?hl=en#XAzRy8oK4zA/libc/stdio/fseek.c&q=fseek&sa=N&cd=1&ct=rc Neil -- http://mail.python.org/mailman/listinfo/python-list