Message229768
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. |
|
Date |
User |
Action |
Args |
2014-10-21 16:45:26 | inkerman | set | recipients:
+ inkerman |
2014-10-21 16:45:26 | inkerman | set | messageid: <1413909926.45.0.828322813526.issue22687@psf.upfronthosting.co.za> |
2014-10-21 16:45:26 | inkerman | link | issue22687 messages |
2014-10-21 16:45:26 | inkerman | create | |
|