GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add bm_base64 covering common base64 module APIs by gpshead · Pull Request #447 · python/pyperformance

Conversation

@gpshead

@gpshead gpshead commented Dec 29, 2025

Copy link
Copy Markdown
Member

Motivation python/cpython#143262 but also in general this wasn't covered and @serhiy-storchaka is also doing work in this area that'll become relevant such as python/cpython#143216.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead
Add bm_base64 covering common base64 module APIs
d0aa8d0
@gpshead gpshead mentioned this pull request Dec 29, 2025
gh-124951: Optimize base64 encode & decode for an easy 2-3x speedup [no SIMD] python/cpython#143262
Merged
@gpshead
gpshead force-pushed the add-bm_base64 branch from 1a1fbda to 177dddf Compare December 29, 2025 04:59
@gpshead
gpshead marked this pull request as ready for review December 29, 2025 05:00
@gpshead
gpshead marked this pull request as draft December 29, 2025 05:02
@gpshead

This comment was marked as resolved.

Sign in to view
gpshead added 2 commits December 29, 2025 05:14
@gpshead
add docs and manifest entry
57acae6
@gpshead
version 1.14.0
41d2855
@gpshead
gpshead force-pushed the add-bm_base64 branch from 177dddf to 41d2855 Compare December 29, 2025 05:16
@gpshead
merge into a smaller # of benchmarks by size
3b95408
@gpshead
gpshead marked this pull request as ready for review December 29, 2025 05:59
@gpshead
gpshead requested a review from serhiy-storchaka December 29, 2025 06:01
serhiy-storchaka
serhiy-storchaka reviewed Dec 29, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the results and the total time?

My suggestions:

  • Test an ASCII string input for decoding.
  • Balance encoding and decoding.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gpshead reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread pyperformance/data-files/benchmarks/bm_base64/run_benchmark.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pyperformance/data-files/benchmarks/bm_base64/run_benchmark.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pyperformance/data-files/benchmarks/bm_base64/run_benchmark.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pyperformance/data-files/benchmarks/bm_base64/run_benchmark.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

gpshead added 2 commits January 1, 2026 18:12
@gpshead
Balance encode and decodes, remove validate=True, cover str input.
1570cad
per review from Serhiy.
@gpshead
update docs
41d1b76
@gpshead

gpshead commented Jan 2, 2026

Copy link
Copy Markdown
Member Author

Example results comparing before and after python/cpython#143262.

main-before-opt-b64.json
========================

Performance version: 1.14.0
Python version: 3.15.0a3+ (64-bit) revision 6b9a6c6ec3b
Report on Linux-6.17.0-8-generic-x86_64-with-glibc2.42
Number of logical CPUs: 15
Start date: 2026-01-02 06:47:53.863590
End date: 2026-01-02 06:54:17.985677

main-after-opt-b64.json
=======================

Performance version: 1.14.0
Python version: 3.15.0a3+ (64-bit) revision 61fc72a4a43
Report on Linux-6.17.0-8-generic-x86_64-with-glibc2.42
Number of logical CPUs: 15
Start date: 2026-01-02 06:30:08.791666
End date: 2026-01-02 06:36:26.047033

### ascii85_large ###
Mean +- std dev: 1.04 sec +- 0.01 sec -> 1.03 sec +- 0.01 sec: 1.01x faster
Not significant

### ascii85_small ###
Mean +- std dev: 20.7 ms +- 0.3 ms -> 20.6 ms +- 0.4 ms: 1.00x faster
Not significant

### base16_large ###
Mean +- std dev: 6.39 ms +- 0.06 ms -> 6.36 ms +- 0.04 ms: 1.00x faster
Not significant

### base16_small ###
Mean +- std dev: 376 us +- 3 us -> 372 us +- 3 us: 1.01x faster
Not significant

### base32_large ###
Mean +- std dev: 585 ms +- 8 ms -> 586 ms +- 7 ms: 1.00x slower
Not significant

### base32_small ###
Mean +- std dev: 11.4 ms +- 0.1 ms -> 11.5 ms +- 0.1 ms: 1.00x slower
Not significant

### base64_large ###
Mean +- std dev: 4.66 ms +- 0.03 ms -> 2.06 ms +- 0.01 ms: 2.26x faster
Significant (t=749.12)

### base64_small ###
Mean +- std dev: 314 us +- 5 us -> 253 us +- 5 us: 1.24x faster
Significant (t=64.73)

### base85_large ###
Mean +- std dev: 432 ms +- 4 ms -> 431 ms +- 4 ms: 1.00x faster
Not significant

### base85_small ###
Mean +- std dev: 8.37 ms +- 0.08 ms -> 8.39 ms +- 0.12 ms: 1.00x slower
Not significant

### urlsafe_base64_small ###
Mean +- std dev: 511 us +- 5 us -> 445 us +- 4 us: 1.15x faster
Significant (t=80.03)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka approved these changes Jan 3, 2026
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to add also ignorechars to support decoding multi-line data. So it may be worth to separate "raw" and "multi-line" cases, if we want to compare the effect of optimization. We could also separate encoding and decoding. But then we will have too much tests. So this is up to you.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead

gpshead commented Jan 3, 2026

Copy link
Copy Markdown
Member Author

yeah i'd initially started out with separate encode/decode but the matrix of benchmark cases got large and pyperformance is not really intended as a microbenchmark. improvements in any of these will be reflected in the overall scores.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead
gpshead merged commit 0976e4a into python:main Jan 3, 2026
19 checks passed

Uh oh!

There was an error while loading. Please reload this page.

maurycy added a commit to maurycy/pyperformance that referenced this pull request Jan 23, 2026
@maurycy
Merge branch 'main' into uv
76a2021
* main:
  Replace pre-commit with prek in CI and add cooldown to Dependabot (python#452)
  Add bm_base64 covering common base64 module APIs (python#447)
@NickCrews NickCrews mentioned this pull request Mar 12, 2026
AttributeErrors raised in .keys() or .__getitem__() during {**mymapping}are incorrectly masked python/cpython#145876
Closed
@NickCrews NickCrews mentioned this pull request Mar 23, 2026
gh-145876: Do not mask AttributeErrors raised during dictionary unpacking python/cpython#145906
Merged
@jayzuccarelli jayzuccarelli mentioned this pull request Oct 27, 2026
Add io_whole_file benchmark and an opt-in io group #498
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gpshead @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.