MoString - fast String concatenation for Mojo
https://github.com/dorjeduck/mostring
MoString is a simple yet fast String concatenation struct in Mojo.
The idea behind the repo is also a bit of a community experiment, wondering if people are interested in contribtung their own implementation of this task to the repo so we can explore options which might flow into the Mojo Standard at one point. Very happy to accept PRs for that.
GitHub
GitHub - dorjeduck/mostring: variations over StringBuilder ideas in...
variations over StringBuilder ideas in Mojo. Contribute to dorjeduck/mostring development by creating an account on GitHub.
1 Reply
I just added an optional parameter to the
MoString
struct which allows the user to specify by which factor the memory should be increased when new memory is needed. In the benchmark i included to this repo i compare MoString
which doubles the memory if needed with MoString[16]
for which the memory space is multiplied by 16 when new memory is needed. Sounds a bit too aggresive right, but MoString[16] brings another 8% performance boost. MoString has also a optimize_memory
method which reduces the allocated memory back to what is actually needed. ..