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.

Author inkerman
Recipients inkerman
Date 2014-10-21.16:45:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413909926.45.0.828322813526.issue22687@psf.upfronthosting.co.za>
In-reply-to
Content
Wrapping a paragraph containing a long word takes a lot of time:

$ time python3 -c 'import textwrap; textwrap.wrap("a" * 2 ** 16)'

real	3m14.923s
user	3m14.792s
sys	0m0.016s
$

A straightforward replacement is 5000 times faster:

$ time python3 -c '("".join(x) for x in zip(*[iter("a" * 2 ** 16)] * 70))'

real	0m0.053s
user	0m0.032s
sys	0m0.016s
$

Tested on Debian with python3.4 3.4.2-1 and python2.7 2.7.8-10.
History
Date User Action Args
2014-10-21 16:45:26inkermansetrecipients: + inkerman
2014-10-21 16:45:26inkermansetmessageid: <1413909926.45.0.828322813526.issue22687@psf.upfronthosting.co.za>
2014-10-21 16:45:26inkermanlinkissue22687 messages
2014-10-21 16:45:26inkermancreate