fix: deserialize DataColumnSidecar without cloning Uint8Array - #8626
Closed
twoeths wants to merge 4 commits into
Closed
fix: deserialize DataColumnSidecar without cloning Uint8Array#8626twoeths wants to merge 4 commits into
twoeths wants to merge 4 commits into
Conversation
twoeths
commented
Nov 22, 2025
| seenTimestampSec, | ||
| }: GossipHandlerParamGeneric<GossipType.data_column_sidecar>) => { | ||
| const {serializedData} = gossipData; | ||
| const dataColumnSidecar = sszDeserialize(topic, serializedData); |
Member
Author
There was a problem hiding this comment.
if this turns out to be more efficient we need to think about upstreaming this to ssz, for example deserialize(true) for sharing Uint8Array and by default deserialize(false) to always clone it (which is what it currently is)
Contributor
Performance Report✔️ no performance regression detected Full benchmark results
|
wemeetagain
added a commit
to ChainSafe/ssz
that referenced
this pull request
Nov 22, 2025
**Motivation** - ChainSafe/lodestar#8623 - ChainSafe/lodestar#8626 **Description** - Add `reuseBytes` option which causes `deserialize` to use [`Uint8Array#subarray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray) instead of [`Uint8Array#slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice). This will cause the deserialized object to share the backing ArrayBuffer of the serialized payload. This is helpful, in some cases, to avoid additional allocations, however special care must be given to avoid corrupting memory using this option. The default behavior of `deserialize` is unchanged.
Member
Author
|
closing in favor of #8628 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8626 +/- ##
============================================
- Coverage 51.96% 51.96% -0.01%
============================================
Files 848 848
Lines 65959 65955 -4
Branches 4814 4813 -1
============================================
- Hits 34275 34272 -3
+ Misses 31615 31614 -1
Partials 69 69 🚀 New features to boost your workflow:
|
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.
Motivation
gcDescription
deserializeDataColumnSidecarUnsafe()to create a view of backed Uint8Array (Uint8Array.subarray()) instead of cloning it (Uint8Array.slice())Closes #8623
Testing
gc, which will lead to lower epoch transition (confirmed that too)DataColumnSidecaris tricky, will review with team later. Need to also pull a profile to make sure