This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: improve performance of binascii.a2b_base64()
Type: performance Stage: resolved
Components: Extension Modules Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, sir-sigurd
Priority: normal Keywords: patch

Created on 2018-09-20 11:45 by sir-sigurd, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9444 merged sir-sigurd, 2018-09-20 11:45
Messages (2)
msg325860 - (view) Author: Sergey Fedoseev (sir-sigurd) * Date: 2018-09-20 11:45
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%)
msg347907 - (view) Author: miss-islington (miss-islington) Date: 2019-07-14 12:15
New changeset 1c5e68e7145f0825f9b952389141edb9436eb43d by Miss Islington (bot) (Sergey Fedoseev) in branch 'master':
bpo-34749: Improved performance of binascii.a2b_base64(). (GH-9444)
https://github.com/python/cpython/commit/1c5e68e7145f0825f9b952389141edb9436eb43d
History
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 78930
2019-07-15 00:14:13petr.viktorinsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-07-14 12:15:36miss-islingtonsetnosy: + miss-islington
messages: + msg347907
2018-09-20 11:45:58sir-sigurdsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8859
2018-09-20 11:45:10sir-sigurdcreate