[issue17812] Quadratic complexity in b32encode

Serhiy Storchaka report at bugs.python.org
Sun Apr 21 23:42:00 CEST 2013


Serhiy Storchaka added the comment:

And here are other patch, which not only fixes an issue with quadratic complexity, but optimize b32encode and b32decode about 2.5 times.

Microbenchmarks:

./python -m timeit -r 1 -n 10 -s "from base64 import b32encode as encode; data = open('python', 'rb').read(1000001)"  "encode(data)"
./python -m timeit -r 1 -n 1 -s "from base64 import b32encode as encode, b32decode as decode; data = encode(open('python', 'rb').read(1000001))"  "decode(data)"

Results:
           First patch  Second patch
b32encode    1.25 sec     486 msec
b32decode    2.08 sec     835 msec

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17812>
_______________________________________


More information about the Python-bugs-list mailing list