adding a length computation benchmark#901
Merged
anonrig merged 1 commit intoyagiz/add-binary-length-base64from Jan 6, 2026
Merged
adding a length computation benchmark#901anonrig merged 1 commit intoyagiz/add-binary-length-base64from
anonrig merged 1 commit intoyagiz/add-binary-length-base64from
Conversation
Member
Author
|
@anonrig I leave this up to you to merge this. |
Member
|
(now we now, my code is slow!) |
Collaborator
|
The AVX2 and AVX-512 versions are much faster though. On a 135090 byte input with my sanitizer-incompatible version: So on Icelake On a tiny 17 byte input the SIMD versions are the same speed as the scalar versions, which suggests that a version that is sanitizer-friendly would be just as fast. Getting the length is thus not a big part of a getting-the-length-then-decoding task. |
anonrig
pushed a commit
that referenced
this pull request
Jan 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a PR ON TOP of @anonrig's PR #887
The purpose here is to anchor the discussion with respect to performance. So that everyone understands what is happening.
To test this out, do the following:
Use a test file. Any would not, but you can create one like so:
Next run the benchmarks, first the decoding benchmark:
Here
-f simdutfapplies a filter so we only run the simdutf functions.Then benchmark the length functions:
Here is what I get on my macbook...
So you see here that
maximal_binary_length_from_base64is effectively free, whilebinary_length_from_base64is not.Suppose you combine the decoding function with the maximal function... then we get
15.82 GB/s(unchanged).But if you combine it with the new function you get 1/(1/8.31 + 1/15.82) or
5.5 GB/s. That is, we reduce by a factor of three the speed. It is not a small effect.