Introduce LocalBuffer#6528
Conversation
| limitations under the License. | ||
| */ | ||
|
|
||
| template <std::size_t EstSizeBound = 1024> class LocalBuffer |
There was a problem hiding this comment.
As @ywkaras said, this 1024 comes from the default arena block size.
1fb143b to
4953523
Compare
|
Is this redundant with #6536 ? |
|
I'd like to keep these commits and PRs separated. #6536 is the first use case, but this could be used anywhere. |
|
Seems a reasonable starting point. I have been working on something similar, but a bit more general. The first is the MemArena class in libswoc++. That's not quite the same - it's based on the internal The other is We might also consider bringing back the MemSpan class which is designed to help with passing back buffer descriptions. Overall, though this seems a reasonable step at this point, since my other projects are still not ready for production. |
A template class for temporally buffer. When requested buffer size is small, a buffer on stuck is used. Co-authored-by: Walt Karas <wkaras@verizonmedia.com>
4953523 to
5508aa3
Compare
|
Pushed new commit address @SolidWallOfCode's comment. Also, I made the type of buffer generic. |
|
[approve ci autest] |
A temporal buffer is needed in some cases. With this
LocalBuffer, when the requested buffer size is smaller than the threshold (1024 in default), we can avoid allocating memory on the heap. Which brings us performance improvements.@ywkaras pointed out this could be an alternative of Arena on
#6495 (comment)
Co-authored-by: Walt Karas wkaras@verizonmedia.com