-
-
Notifications
You must be signed in to change notification settings - Fork 411
feat: fromHexInto() api #8275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: fromHexInto() api #8275
Conversation
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
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## unstable #8275 +/- ##
============================================
- Coverage 54.25% 54.23% -0.02%
============================================
Files 847 847
Lines 63852 63844 -8
Branches 4835 4839 +4
============================================
- Hits 34640 34625 -15
- Misses 29135 29142 +7
Partials 77 77 🚀 New features to boost your workflow:
|
Contributor
Performance Report✔️ no performance regression detected Full benchmark results
|
nflaig
approved these changes
Aug 27, 2025
Member
|
Seeing the opposite using Bun. Will be interesting and important to rebench when we start using Bun. |
wemeetagain
approved these changes
Aug 27, 2025
Member
|
🎉 This PR is included in v1.34.0 🎉 |
wemeetagain
added a commit
that referenced
this pull request
Oct 23, 2025
**Motivation** - #7280 **Description** - Build upon the isomorphic bytes code in the utils package - refactor browser/nodejs selection to use conditional imports (like how we've been handling bun / nodejs selection - Use Uint8Array.fromHex and toHex (mentioned in #8275 (comment)) - Refactor the bytes perf tests to include bun - Add lodestar-bun dependency (also add missing dependency in beacon-node package) Results from my machine ``` bytes utils ✔ nodejs block root to RootHex using toHex 5500338 ops/s 181.8070 ns/op - 1048 runs 0.444 s ✔ nodejs block root to RootHex using toRootHex 7466866 ops/s 133.9250 ns/op - 2189 runs 0.477 s ✔ nodejs fromHex(blob) 7001.930 ops/s 142.8178 us/op - 10 runs 1.94 s ✔ nodejs fromHexInto(blob) 1744.298 ops/s 573.2965 us/op - 10 runs 6.33 s ✔ nodejs block root to RootHex using the deprecated toHexString 1609510 ops/s 621.3070 ns/op - 309 runs 0.704 s ✔ browser block root to RootHex using toHex 1854390 ops/s 539.2610 ns/op - 522 runs 0.807 s ✔ browser block root to RootHex using toRootHex 2060543 ops/s 485.3090 ns/op - 597 runs 0.805 s ✔ browser fromHex(blob) 1632.601 ops/s 612.5196 us/op - 10 runs 6.77 s ✔ browser fromHexInto(blob) 1751.718 ops/s 570.8683 us/op - 10 runs 6.36 s ✔ browser block root to RootHex using the deprecated toHexString 1596024 ops/s 626.5570 ns/op - 457 runs 0.805 s ✔ bun block root to RootHex using toHex 1.249563e+7 ops/s 80.02800 ns/op - 4506 runs 0.518 s ✔ bun block root to RootHex using toRootHex 1.262626e+7 ops/s 79.20000 ns/op - 3716 runs 0.409 s ✔ bun fromHex(blob) 26995.09 ops/s 37.04377 us/op - 10 runs 0.899 s ✔ bun fromHexInto(blob) 31539.09 ops/s 31.70668 us/op - 13 runs 0.914 s ✔ bun block root to RootHex using the deprecated toHexString 1.252944e+7 ops/s 79.81200 ns/op - 3616 runs 0.414 s ```
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.
Motivation
332.6842 ms/opto more or less 2msDescription
fromHexInto()usingString.charCodeAt()for browser and use that for NodeJs as wellTest result on a regular lodestar node
browser fromHexInto(blob)is 1000x faster thanbrowser fromHex(blob)and >100x faster thannodejs fromHexInto(blob)