This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [py2] TextIOWrapper.tell extremely slow
Type: performance Stage: resolved
Components: IO Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Mariatta, benjamin.peterson, berker.peksag, pitrou, rmalouf, terry.reedy, vstinner
Priority: normal Keywords:

Created on 2016-10-02 15:51 by rmalouf, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1742 closed rmalouf, 2017-05-23 00:10
Messages (6)
msg277898 - (view) Author: Rob Malouf (rmalouf) * Date: 2016-10-02 15:51
io.TextIOWrapper.tell() is unusably slow in Python 2.7.  This same problem was introduced in Python 3 and fixed in Python 3.3 (see Issue # 11114).  Any chance of getting the fix backported into the Python 2.7 library? It would make it much easier to modernize Unicode handling in libraries that have to support both 2 and 3 using the same codebase.
msg278278 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-10-07 22:12
I suggest that you try backporting the patch to 2.7 and and/or ask on #11114 whether there was a positive reason not to do so (and mention that you opened this issue to do so).
msg305535 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-11-04 06:44
Anyone here capable of reviewing the PR?
msg305537 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-11-04 07:37
From the original report:

> This problem did not exist in version 2.7.1 [...]

We usually don't treat performance improvements as bug fixes unless it was introduced in a bug fix release (or it needs to be explicitly approved by the BDFL or the 2.7 release manager)

If TextIOWrapper.tell() performance got worse after 2.7.1, there might be a chance to backport issue 11114 to 2.7.

Adding Antoine (author of the patch) and Benjamin (2.7. release manager) to get their opinion.
msg305551 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-11-04 10:19
The original patch is quite delicate and I'm not comfortable backporting to 2.7.  This is why it was pushed to 3.3 but not backported to 3.2.x (AFAIR).  2.7 has existed with this issue for years, now, and is slowly nearing end-of-life.  I'll let Benjamin make the final decision.
msg305652 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-06 16:37
Berker Peksag, Antoine Pitrou (who implemented the discussed change) and me are opposed to backporting this optimization, so I close the issue as WONTFIX.

The only known workaround is to upgrade to Python 3, sorry!

Benjamin: Please speakup if you want this optimization in the next Python 2.7 release ;-)


> The original patch is quite delicate and I'm not comfortable backporting to 2.7.

Oh, the "byte/character ratio" "hack"... I'm not confortable with this one neither, even if it seems like it works on Python 3 (I didn't recall any bug report related to this).
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72527
2017-11-06 16:37:21vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg305652

resolution: wont fix
stage: patch review -> resolved
2017-11-04 10:19:15pitrousetmessages: + msg305551
2017-11-04 07:37:59berker.peksagsetnosy: + pitrou, berker.peksag, benjamin.peterson
messages: + msg305537
2017-11-04 06:44:49Mariattasetnosy: + Mariatta

messages: + msg305535
stage: patch review
2017-05-23 00:10:13rmaloufsetpull_requests: + pull_request1832
2016-10-18 14:45:19vstinnersettitle: TextIOWrapper.tell extremely slow -> [py2] TextIOWrapper.tell extremely slow
2016-10-07 22:12:42terry.reedysetnosy: + terry.reedy
messages: + msg278278
2016-10-02 15:51:27rmaloufcreate