New submission from Piotr Engelking: 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. ---------- messages: 229768 nosy: inkerman priority: normal severity: normal status: open title: horrible performance of textwrap.wrap() with a long word type: performance versions: Python 2.7, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22687> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com