Repository navigation
In-place encoding #376
heroin-moose
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have a product that transfers flatbuffers over ring buffer in a shared memory between processes. Every slot is fixed size, so I can safely build in there, processing multiple events at once in async fashion. Building in-place would eliminate copying from heap, saving me some CPU time, given that transferred payloads can be quite large (up to 512k).
I propose a new API:
Builder::from_slice();
Builder::try_finish();
The first function will create a builder backed by a slice that cannot grow. The second will check that no overflow happened during building, returning an error if it did. Checking for overflow at the final stage allows to keep existing setters API intact.
All reactions