str_stack is a string allocation library for allocating many temporally correlated write-once strings. This is useful when you need to e.g. read a set of small files into strings but don’t want to allocate a new string per file. Additionally, this library provides great cache locality.
Currently, the performance (on my laptop) is as follows:
- Allocation: ~2.5x speedup (for 1000 strings) (~42ns per string)
- Indexing: 0.73x speedup (slower) (~1.7ns per index)
- Iterate: 0.35x speedup (much slower) (~1ns per iteration)
It should be possible to further speedup allocation (see the open issue) but speeding up indexing/iteration are beyond me.
I’ll put it on crates.io if people find it useful but, for now, I don’t even know if this is the right approach.