capnproto-rust icon indicating copy to clipboard operation
capnproto-rust copied to clipboard

Use `SmallVec` in builder arena to avoid heap allocation for single-segment case

Open marmeladema opened this issue 2 years ago • 5 comments

marmeladema avatar Jan 14 '23 15:01 marmeladema

Does this actually help performance? Last time I tried it seemed to make things a bit slower.

dwrensha avatar Jan 16 '23 13:01 dwrensha

I never meant to close this 😑

marmeladema avatar Jan 16 '23 19:01 marmeladema

I haven't run the benchmarks yet, and to be honest, I don't care much about this because I have another change I want to propose on top of the refactor build arena PR where I make a builder re-usable.

marmeladema avatar Jan 16 '23 19:01 marmeladema

where I make a builder re-usable.

What kind of builder? A message::Builder? Can you explain more about your plan?

Does the existing message::ScratchSpaceHeapAllocator work for your use case?

dwrensha avatar Jan 16 '23 19:01 dwrensha

The allocator is only part of the solution. I want to re-use the vec of segments in the builder arena.

marmeladema avatar Jan 16 '23 19:01 marmeladema