[issue11114] file.tell extremely slow

Laurens report at bugs.python.org
Fri Feb 4 11:40:18 CET 2011


Laurens <3.14159265358 at xs4all.nl> added the comment:

Correction: the problem also exists in version 3.1. I created a benchmark program an ran it on my machine (iMac, snow leopard 10.6), with the following results:

------------------------------------------
2.6.6 (r266:84292, Dec 30 2010, 09:20:14) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 0.0009 s.
------------------------------------------
2.7.1 (r271:86832, Jan 13 2011, 07:38:03) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 0.0008 s.
------------------------------------------
3.1.3 (r313:86882M, Nov 30 2010, 09:55:56) 
[GCC 4.0.1 (Apple Inc. build 5494)]
result: 9.5682 s.
------------------------------------------
3.2rc2 (r32rc2:88269, Jan 30 2011, 14:30:28) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 8.3531 s.

Removing the line containing "tell" gives the following results:

------------------------------------------
2.6.6 (r266:84292, Dec 30 2010, 09:20:14) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 0.0007 s.
------------------------------------------
2.7.1 (r271:86832, Jan 13 2011, 07:38:03) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 0.0006 s.
------------------------------------------
3.1.3 (r313:86882M, Nov 30 2010, 09:55:56) 
[GCC 4.0.1 (Apple Inc. build 5494)]
result: 0.0093 s.
------------------------------------------
3.2rc2 (r32rc2:88269, Jan 30 2011, 14:30:28) 
[GCC 4.2.1 (Apple Inc. build 5664)]
result: 0.0007 s.


(Apparently, reading a file became a lot faster from 3.1 to 3.2.)

Conclusion: Execution of file.tell() makes the program about 10000 times slower.

Remark: the file mdutch.txt is a dummy text file containing 1000 lines with one word on each line.

----------
Added file: http://bugs.python.org/file20674/tell v01.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11114>
_______________________________________


More information about the Python-bugs-list mailing list