Repository navigation
Avoid copying Cereal input buffers before deserialization - #757
Merged
liuzicheng1987 merged 2 commits intoOct 25, 2026
Merged
liuzicheng1987 merged 2 commits into
liuzicheng1987 merged 2 commits into
Conversation
Collaborator
|
@Altren thanks |
liuzicheng1987
merged commit Oct 25, 2026
6719a9c
into
munich-data-engineering:main
176 checks passed
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.
Cereal's
read(bytes)copies the entire input into a string-backed stream before decoding it. Replace that stream with a non-owning input buffer, removing the extra allocation and copy for byte-buffer reads and forload()calls that use them. The public APIs, binary representation, and bulk file loading remain unchanged.The shared internal buffer exposes only an input area, handles empty/null buffers without null-pointer arithmetic, and bounds block reads to the supplied extent. Boost.Serialization reuses it in place of its existing non-owning
MemBuf; Boost already avoided the owning input copy.Read time
Compared upstream main
26c66bfa(including #753) with this change on macOS arm64timings.A dash denotes a time difference below 3%. Record16 has sixteen float fields. Dataset contains 500 groups, each with 3,000 two-double points and 3,000 uint64 IDs. Numeric vectors already use bulk arithmetic I/O in both versions.
Peak memory
Peak resident memory from three fresh processes per case/configuration, measured with macOS
getrusage; table shows the no-LTO medians. This includes the encoded input, decoded output, and process/runtime overhead. Fixtures are generated in a separate process, and no timed benchmark runs first. These are whole-process peaks, not exact allocation counts; LTO measurements are retained in the local report.