René's URL Explorer Experiment


Title: gh-101178: Add Ascii85, Base85, and Z85 support to binascii by kangtastic · Pull Request #102753 · python/cpython · GitHub

Open Graph Title: gh-101178: Add Ascii85, Base85, and Z85 support to binascii by kangtastic · Pull Request #102753 · python/cpython

X Title: gh-101178: Add Ascii85, Base85, and Z85 support to binascii by kangtastic · Pull Request #102753 · python/cpython

Description: Synopsis Add Ascii85, Base85, and Z85 encoder and decoder functions implemented in C to binascii and use them to greatly improve the performance and reduce the memory usage of the existing Ascii85, Base85, and Z85 codec functions in base64. No API or documentation changes are necessary with respect to any functions in base64, and all existing unit tests for those functions continue to pass without modification. Resolves: gh-101178 Discussion The base85-related functions in base64 are now wrappers for the new functions in binascii, as envisioned in the docs: The binascii module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like uu or base64 instead. The binascii module contains low-level functions written in C for greater speed that are used by the higher-level modules. Parting out Ascii85 from Base85 and Z85 was warranted in my testing despite the code duplication due to the various performance-murdering special cases in Ascii85. Comments and questions are welcome. Benchmarks Updated December 28, 2025. # bench_b85.py # Note: EXTREMELY SLOW on unmodified mainline CPython # when tracing malloc on the base-85 functions. import base64 import sys import timeit import tracemalloc funcs = [(base64.b64encode, base64.b64decode), # sanity check/comparison (base64.a85encode, base64.a85decode), (base64.b85encode, base64.b85decode), (base64.z85encode, base64.z85decode)] def mb(n): return f"{n / 1024 / 1024:.3f} MB" def stats(func, data, t, m): name, n, bps = func.__qualname__, len(data), len(data) / t print(f"{name} : {n} b in {t:.3f} s ({mb(bps)}/s) using {mb(m)}") if __name__ == "__main__": data = b"a" * int(sys.argv[1]) * 1024 * 1024 for fenc, fdec in funcs: tracemalloc.start() enc = fenc(data) menc = tracemalloc.get_traced_memory()[1] - len(enc) tracemalloc.stop() tenc = timeit.timeit("fenc(data)", number=1, globals=globals()) stats(fenc, data, tenc, menc) tracemalloc.start() dec = fenc(enc) mdec = tracemalloc.get_traced_memory()[1] - len(dec) tracemalloc.stop() tdec = timeit.timeit("fdec(enc)", number=1, globals=globals()) stats(fdec, enc, tdec, mdec) # Python 3.15.0a3+ (heads/main:0efbad60e13, Dec 28 2025, 11:02:16) # ./configure --enable-optimizations --with-lto # Unmodified $ time ./python bench_b85.py 64 b64encode : 67108864 b in 0.092 s (693.266 MB/s) using 42.667 MB b64decode : 89478488 b in 0.234 s (364.961 MB/s) using 56.889 MB a85encode : 67108864 b in 7.163 s (8.935 MB/s) using 2664.401 MB a85decode : 83886080 b in 14.478 s (5.526 MB/s) using 3332.254 MB b85encode : 67108864 b in 6.965 s (9.189 MB/s) using 2664.401 MB b85decode : 83886080 b in 10.082 s (7.935 MB/s) using 3332.254 MB z85encode : 67108864 b in 7.245 s (8.834 MB/s) using 2664.102 MB z85decode : 83886080 b in 9.666 s (8.277 MB/s) using 3332.254 MB real 9m44.382s user 9m27.271s sys 0m12.747s # With this PR b64encode : 67108864 b in 0.085 s (753.375 MB/s) using 42.667 MB b64decode : 89478488 b in 0.230 s (371.282 MB/s) using 56.889 MB a85encode : 67108864 b in 0.094 s (681.709 MB/s) using 0.000 MB a85decode : 83886080 b in 0.191 s (418.019 MB/s) using 0.000 MB b85encode : 67108864 b in 0.075 s (850.118 MB/s) using 0.000 MB b85decode : 83886080 b in 0.141 s (567.490 MB/s) using 0.000 MB z85encode : 67108864 b in 0.074 s (864.559 MB/s) using 0.000 MB z85decode : 83886080 b in 0.173 s (462.854 MB/s) using 0.000 MB real 0m1.865s user 0m1.726s sys 0m0.126s The old pure-Python implementation is two orders of magnitude slower and uses over O(40n) temporary memory.

Open Graph Description: Synopsis Add Ascii85, Base85, and Z85 encoder and decoder functions implemented in C to binascii and use them to greatly improve the performance and reduce the memory usage of the existing Ascii85,...

X Description: Synopsis Add Ascii85, Base85, and Z85 encoder and decoder functions implemented in C to binascii and use them to greatly improve the performance and reduce the memory usage of the existing Ascii85,...

Opengraph URL: https://github.com/python/cpython/pull/102753

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/checks(.:format)
route-controllerpull_requests
route-actionchecks
fetch-noncev2:f7014688-0382-1462-0e17-1cde38a48a2e
current-catalog-service-hash87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a
request-idCFDE:16E0FE:ABF9B:F0485:696A0CD1
html-safe-nonceb8dade41d68c87284e1fff204c7519734599a2f34979254d828ab70cd3891531
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkRFOjE2RTBGRTpBQkY5QjpGMDQ4NTo2OTZBMENEMSIsInZpc2l0b3JfaWQiOiI2OTAwMzQyMjUzOTE4MjI3NjY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca1feb2136a407708790ed7cd5b4c41547c7e5f77372cb9f3990d4682d9933794
hovercard-subject-tagpull_request:1278422982
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/checks
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/102753/checks
twitter:imagehttps://avatars.githubusercontent.com/u/942136?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/942136?s=400&v=4
og:image:altSynopsis Add Ascii85, Base85, and Z85 encoder and decoder functions implemented in C to binascii and use them to greatly improve the performance and reduce the memory usage of the existing Ascii85,...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595
turbo-cache-controlno-cache
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width full-width-p-0
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7266b2d935baa1c6474b16dd9feaa5ca30607261
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/102753/checks#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F102753%2Fchecks
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F102753%2Fchecks
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Fchecks&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/102753/checks
Reloadhttps://github.com/python/cpython/pull/102753/checks
Reloadhttps://github.com/python/cpython/pull/102753/checks
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/102753/checks
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/102753/checks
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
kangtastichttps://github.com/kangtastic
python:mainhttps://github.com/python/cpython/tree/main
kangtastic:gh-101178-rework-base85https://github.com/kangtastic/cpython/tree/gh-101178-rework-base85
Conversation 60 https://github.com/python/cpython/pull/102753
Commits 31 https://github.com/python/cpython/pull/102753/commits
Checks 43 https://github.com/python/cpython/pull/102753/checks
Files changed https://github.com/python/cpython/pull/102753/files
Please reload this pagehttps://github.com/python/cpython/pull/102753/checks
Please reload this pagehttps://github.com/python/cpython/pull/102753/checks
Sign in for the full log viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F102753%2Fchecks
gh-101178: Add Ascii85, Base85, and Z85 support to binascii https://github.com/python/cpython/pull/102753/checks#top
Please reload this pagehttps://github.com/python/cpython/pull/102753/checks
Check labels on: pull_request https://github.com/python/cpython/actions/runs/20995140485
DO-NOT-MERGE https://github.com/python/cpython/actions/runs/20995140485/job/60349924954?pr=102753
Unresolved review https://github.com/python/cpython/actions/runs/20995140485/job/60349924932?pr=102753
Tests on: pull_request https://github.com/python/cpython/actions/runs/20995140486
Change detection / Create context from changed files https://github.com/python/cpython/actions/runs/20995140486/job/60349924993?pr=102753
Docs / Docs https://github.com/python/cpython/actions/runs/20995140486/job/60349967000?pr=102753
Docs / Doctest https://github.com/python/cpython/actions/runs/20995140486/job/60349966990?pr=102753
Docs / Check EPUB https://github.com/python/cpython/actions/runs/20995140486/job/60349966985?pr=102753
Check if Autoconf files are up to date https://github.com/python/cpython/actions/runs/20995140486/job/60349966537?pr=102753
Check if generated files are up to date https://github.com/python/cpython/actions/runs/20995140486/job/60349966572?pr=102753
C API Docs / Check if all C APIs are documented https://github.com/python/cpython/actions/runs/20995140486/job/60349966895?pr=102753
Windows / Build and test (x64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966917?pr=102753
Windows (free-threading) / Build and test (x64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966899?pr=102753
Windows / Build and test (Win32) https://github.com/python/cpython/actions/runs/20995140486/job/60349966939?pr=102753
Windows / Build and test (arm64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966928?pr=102753
Windows (free-threading) / Build and test (arm64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966925?pr=102753
Windows MSI${{ '' }} https://github.com/python/cpython/actions/runs/20995140486/job/60349966869?pr=102753
macOS / build and test (macos-14) https://github.com/python/cpython/actions/runs/20995140486/job/60349966956?pr=102753
macOS (free-threading) / build and test (macos-14) https://github.com/python/cpython/actions/runs/20995140486/job/60349966958?pr=102753
macOS / build and test (macos-15-intel) https://github.com/python/cpython/actions/runs/20995140486/job/60349966970?pr=102753
Ubuntu / build and test (ubuntu-24.04) https://github.com/python/cpython/actions/runs/20995140486/job/60349966968?pr=102753
Ubuntu / build and test (ubuntu-24.04-arm) https://github.com/python/cpython/actions/runs/20995140486/job/60349966969?pr=102753
Ubuntu (free-threading) / build and test (ubuntu-24.04) https://github.com/python/cpython/actions/runs/20995140486/job/60349966949?pr=102753
Ubuntu (free-threading) / build and test (ubuntu-24.04-arm) https://github.com/python/cpython/actions/runs/20995140486/job/60349966974?pr=102753
Ubuntu (bolt) / build and test (ubuntu-24.04) https://github.com/python/cpython/actions/runs/20995140486/job/60349966948?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 1.1.1w) https://github.com/python/cpython/actions/runs/20995140486/job/60349966703?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 3.0.18) https://github.com/python/cpython/actions/runs/20995140486/job/60349966695?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 3.2.6) https://github.com/python/cpython/actions/runs/20995140486/job/60349966716?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 3.3.5) https://github.com/python/cpython/actions/runs/20995140486/job/60349966822?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 3.4.3) https://github.com/python/cpython/actions/runs/20995140486/job/60349966728?pr=102753
Ubuntu SSL tests with OpenSSL (ubuntu-24.04, 3.5.4) https://github.com/python/cpython/actions/runs/20995140486/job/60349966711?pr=102753
Ubuntu SSL tests with AWS-LC (ubuntu-24.04, 1.55.0) https://github.com/python/cpython/actions/runs/20995140486/job/60349966605?pr=102753
Android (aarch64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966594?pr=102753
Android (x86_64) https://github.com/python/cpython/actions/runs/20995140486/job/60349966567?pr=102753
iOS https://github.com/python/cpython/actions/runs/20995140486/job/60349966791?pr=102753
WASI / build and test https://github.com/python/cpython/actions/runs/20995140486/job/60349966888?pr=102753
Hypothesis tests on Ubuntu https://github.com/python/cpython/actions/runs/20995140486/job/60349966765?pr=102753
Address sanitizer (ubuntu-24.04) https://github.com/python/cpython/actions/runs/20995140486/job/60349966805?pr=102753
Sanitizers / TSan https://github.com/python/cpython/actions/runs/20995140486/job/60349966978?pr=102753
Sanitizers / TSan (free-threading) https://github.com/python/cpython/actions/runs/20995140486/job/60349966986?pr=102753
Sanitizers / UBSan https://github.com/python/cpython/actions/runs/20995140486/job/60349966984?pr=102753
Cross build Linux https://github.com/python/cpython/actions/runs/20995140486/job/60349966801?pr=102753
CIFuzz https://github.com/python/cpython/actions/runs/20995140486/job/60349967070?pr=102753
All required checks pass https://github.com/python/cpython/actions/runs/20995140486/job/60352618016?pr=102753
Lint on: pull_request https://github.com/python/cpython/actions/runs/20995140511
lint https://github.com/python/cpython/actions/runs/20995140511/job/60349924977?pr=102753
Check whether this PR is a feature (contains a "type-feature" label) https://github.com/python/cpython/pull/102753/checks#annotation:3:13
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.