[New-bugs-announce] [issue34749] improve performance of binascii.a2b_base64()

Sergey Fedoseev report at bugs.python.org
Thu Sep 20 07:45:10 EDT 2018


New submission from Sergey Fedoseev <fedoseev.sergey at gmail.com>:

I reworked implementation of binascii.a2b_base64() and there is significant speedup:

$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "from binascii import b2a_base64, a2b_base64; s = b2a_base64(1000 * b'b')" "a2b_base64(s)"
/home/sergey/tmp/cpython-master-venv/bin/python: ..................... 3.43 us +- 0.01 us
/home/sergey/tmp/cpython-dev-venv/bin/python: ..................... 1.52 us +- 0.01 us
Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 3.43 us +- 0.01 us -> [/home/sergey/tmp/cpython-dev-venv/bin/python] 1.52 us +- 0.01 us: 2.26x faster (-56%)

$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "from binascii import b2a_base64, a2b_base64; s = b2a_base64(1 * b'b')" "a2b_base64(s)"
/home/sergey/tmp/cpython-master-venv/bin/python: ..................... 76.0 ns +- 0.2 ns
/home/sergey/tmp/cpython-dev-venv/bin/python: ..................... 69.2 ns +- 0.1 ns
Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 76.0 ns +- 0.2 ns -> [/home/sergey/tmp/cpython-dev-venv/bin/python] 69.2 ns +- 0.1 ns: 1.10x faster (-9%)

----------
components: Extension Modules
messages: 325860
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: improve performance of binascii.a2b_base64()
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34749>
_______________________________________


More information about the New-bugs-announce mailing list