[issue11114] TextIOWrapper.tell extremely slow

2011-02-25 Thread Antoine Pitrou
Antoine Pitrou added the comment: Committed in r88607 (3.3). -- resolution: accepted -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Laurens
Laurens <3.14159265...@xs4all.nl> added the comment: All, thanks for your help. Opening the file in binary mode worked immediately in the toy program (that is, the benchmark code I sent you). (Antoine, thanks for the hint.) In my real world program, I solved the problem by reading a line from

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: New patch also optimizing the C version. tell() can be more than 100x faster now (still much slower than binary tell()). -- stage: needs patch -> patch review Added file: http://bugs.python.org/file20680/textiotell2.patch _

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Here is a proof-of-concept patch for the pure Python version of > TextIOWrapper.tell(). It turns the O(CHUNK_SIZE) operation into an > O(1) operation most of time (still O(CHUNK_SIZE) worst-case - weird > decoders and/or crazy input). Actually, that's wrong.

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a proof-of-concept patch for the pure Python version of TextIOWrapper.tell(). It turns the O(CHUNK_SIZE) operation into an O(1) operation most of time (still O(CHUNK_SIZE) worst-case - weird decoders and/or crazy input). -- keywords: +patch A

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: > opening file binary has a dramatic effect as well, I would say. After 2 > minutes I stopped execution of the program Hint: b'' is not equal to '' ;) -- ___ Python tracker

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Laurens
Laurens <3.14159265...@xs4all.nl> added the comment: First of all, thanks to all for your cooperation, it is very much appreciated. I made some minor changes to the benchmark program. Conclusions are: * setting file._CHUNK_SIZE to 20 has a dramatic effect, changing execution time in 3.2rc2 fr

[issue11114] TextIOWrapper.tell extremely slow

2011-02-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: That said, I think it is possible to make algorithmic improvements to TextIOWrapper.tell() so that at least performance becomes acceptable. -- stage: -> needs patch title: file.tell extremely slow -> TextIOWrapper.tell extremely slow type: -> perform