roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.02k stars 204 forks source link

Make core::StringBuffer non-template #600

Closed gavv closed 9 months ago

gavv commented 9 months ago

core::StringBuffer implements simple buffer for storing strings.

Currently it's a template class. It has only one template parameter: EmbeddedCapacity, which defines number of bytes embedded directly into StringBuffer object. (Short strings can be stored in this capacity without heap allocations).

However, we can still cover most use cases if we hard-code specific value of EmbeddedCapacity instead of making it configurable. For example, we can set it to 32 bytes.

If we do so, we can make StringBuffer non-template. Having lots of templates increases code size and compilation times. Also, it will allow us to simplify implementation of core::StringBuilder.

So the steps are simple:

Then cleanup StringBuilder:

ForeverASilver commented 9 months ago

@gavv I'll take a crack at it if you assign it to me

gavv commented 9 months ago

Thanks!