Serhiy Storchaka added the comment: Here is a patch for 3.4 based on Matt's patch with additional optimizations. It speeds up body_encode() and header_encode().
$ ./python -m timeit -s "from email.quoprimime import body_encode as encode; x = open('Lib/decimal.py').read()[:100000]" "encode(x)" Before patch: 1.12 sec per loop After patch: 26.3 msec per loop $ ./python -m timeit -s "from email.quoprimime import header_encode as encode; x = b'A'*100" "encode(x)" Before patch: 97.9 usec per loop After patch: 23.7 usec per loop For non-ascii data difference is even larger. ---------- stage: needs patch -> patch review Added file: http://bugs.python.org/file30249/email_quoprimime_fast_encode.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5803> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com