file seek is slow

Metalone jcb at iteris.com
Thu Mar 11 14:01:39 EST 2010


I am assuming that Python delegates the f.seek call to the seek call
in the MS C runtime library msvcrt.dll.
Does anybody know a nice link to the Python source like was posted
above for the BSD 'C' library?

Ok, I ran some more tests.
C, seek            : 0.812 seconds   // test from original post
Python, f.seek     : 1.458 seconds.  // test from original post

C, time(&tm)       : 0.671 seconds
Python, time.time(): 0.513 seconds.
Python, ctypes.msvcrt.time(ctypes.byref(tm)): 0.971 seconds.   #
factored the overhead to be outside the loop, so really this was
func_ptr(ptr).

Perhaps I am just comparing apples to oranges.
I never tested the overhead of ctypes like this before.
Most of my problem timings involve calls through ctypes.



More information about the Python-list mailing list