file seek is slow
Antoine Pitrou
solipsis at pitrou.net
Fri Mar 12 11:57:37 EST 2010
Le Tue, 09 Mar 2010 15:56:47 -0800, Metalone a écrit :
> for i in xrange(1000000):
> f1.seek(0)
This is quite a stupid benchmark to write, since repeatedly seeking to 0
is a no-op. I haven't re-read the file object code recently, but chances
are that the Python file object has its own bookkeeping which adds a bit
of execution time.
But I would suggest measuring the performance of *actual* seeks to
different file offsets, before handwaving about the supposed "slowness"
of file seeks in Python.
Regards
Antoine.
More information about the Python-list
mailing list