fix: emit the binary encoding in one call - #18
Merged
Conversation
The non-human-readable branch went through `<[u8]>::serialize`, which is a `serialize_seq` plus one `serialize_element` per byte. Formats still write length-then-bytes, so the wire is unaffected, but they are asked to do it a byte at a time: a 1 MiB blob is 1,048,576 calls where one would do. `serialize_bytes` states the whole blob at once. Measured on bincode with a 1 MiB field, 974 us -> 19 us. The gap widens to 6.3 ms -> 19 us when the value is serialized through a `&mut dyn erased_serde::Serializer`, because there each of those million calls is also a virtual call; that is what led us here. `binary_encoding_is_unchanged_since_0_1_0` pins the 0.1.0 encodings as literals rather than deriving them from the current code, and checks both directions: that this version still writes them, and still reads them. Verified against downstream too -- the 32 reference-vector tests in espresso-network, covering every protocol version's headers, payloads, transactions and VID data, pass unchanged with this patched in.
Behaviour-only; the API and the encoding are unchanged, so a patch bump. Publishing is tag-triggered, so this only prepares the version.
bfish713
approved these changes
Sep 1, 2026
GitHub auto-fails the pinned v4.0.1 as a deprecated release. Track the major tag, as every other action here already does.
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.
No description provided.