[issue10045] poor cStringIO.StringO seek performance
Changes by Fred L. Drake, Jr. fdr...@acm.org: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Fred L. Drake, Jr. fdr...@acm.org added the comment: Causing perfectly good Python 2 applications to degrade in performance is bad, even if something else is available. This should be fixed as a regression. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Antoine Pitrou pit...@free.fr added the comment: This should be fixed as a regression. As far as I understand, this is not a regression. I don't think the cStringIO code has changed in years. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Fred L. Drake, Jr. fdr...@acm.org added the comment: Ok, reading more carefully, it's not a regression. But it's certainly a bug, and should be fixed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Antoine Pitrou pit...@free.fr added the comment: Ok, reading more carefully, it's not a regression. But it's certainly a bug, and should be fixed. Right. The patch looks straightforward, but I'm not familiar with the cStringIO code. Could you take a look? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Fred L. Drake, Jr. fdr...@acm.org added the comment: Assigning to myself for review. -- assignee: - fdrake keywords: +needs review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Fred L. Drake, Jr. fdr...@acm.org added the comment: Committed with minor changes in r85366 (release27-maint branch). -- keywords: -needs review resolution: - accepted status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Patrick Strawderman patr...@zope.com added the comment: Fair enough, but there is a great deal of existing code that already uses cStringIO. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
New submission from Patrick Strawderman patr...@zope.com: cStringIO.StringO's seek method has O(n) characteristics in certain, albeit pathological, cases, while the pure Python implementation and cStringIO.StringI's seek methods both execute in constant time in all cases. When the file offset is set n bytes beyond the end of actual data, the gap is filled in with n bytes in cStringIO.StringO's seek method. however, POSIX states that reads of data in the gap will return null bytes only if a subsequent write has taken place, so filling in the gap is not required at the time of the seek. This patch for 2.7 corrects the behavior by unifying StringO and StringI's seek methods, and moving the writing of null bytes to StringO's write method. There may be a more elegant way to write this, I don't know. I believe this issue affects Python 3 as well, though I have yet to test it. NOTE: Perhaps this seems like an extreme edge case not worthy of a fix, but this actually caused problems for us when parsing images with malformed EXIF data; a web request for uploading such a photo was taking on the order of 15 minutes. When we stopped using cStringIO.StringO, it took seconds. -- files: cStringIO.diff keywords: patch messages: 118123 nosy: boogenhagn priority: normal severity: normal status: open title: poor cStringIO.StringO seek performance versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file19150/cStringIO.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Changes by Patrick Strawderman patr...@zope.com: -- components: +None type: - performance ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Changes by Patrick Strawderman patr...@zope.com: -- components: -None ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Patrick Strawderman patr...@zope.com added the comment: The second sentence should have said the gap is filled in with n null bytes -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
R. David Murray rdmur...@bitdance.com added the comment: I'm changing the versions to just 2.7 (though I'm not sure this can be considered a bug fix), since StringIO is reimplemented as part of io in 3.x. -- nosy: +r.david.murray versions: -Python 2.6, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10045] poor cStringIO.StringO seek performance
Antoine Pitrou pit...@free.fr added the comment: I don't think there's much point in fixing this. 2.7 users can use io.BytesIO, which is a fast type implemented in C. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com