Issue 28340: [py2] TextIOWrapper.tell extremely slow (original) (raw)

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:37 admin set github: 72527
2017-11-06 16:37:21 vstinner set status: open -> closednosy: + vstinnermessages: + resolution: wont fixstage: patch review -> resolved
2017-11-04 10:19:15 pitrou set messages: +
2017-11-04 07:37:59 berker.peksag set nosy: + pitrou, berker.peksag, benjamin.petersonmessages: +
2017-11-04 06:44:49 Mariatta set nosy: + Mariattamessages: + stage: patch review
2017-05-23 00:10:13 rmalouf set pull_requests: + <pull%5Frequest1832>
2016-10-18 14:45:19 vstinner set title: TextIOWrapper.tell extremely slow -> [py2] TextIOWrapper.tell extremely slow
2016-10-07 22:12:42 terry.reedy set nosy: + terry.reedymessages: +
2016-10-02 15:51:27 rmalouf create