Bepis
Is there a faster way of splitting strings?
I feel like I've hit a local minimum with my code. Basically it splits strings on certain characters and lowercases the result, eg.
"This fair child of mine\nShall sum my count, and make my old excuse"
into
[this, fair, child, of, mine, shall, sum, my, count, and, make, my, old, excuse]
It processes 100MB of text content in 2.33 seconds, but I feel like it should be able to go faster.
- It's too much of a hassle to use Memory<char>
elsewhere in the code, instead of returning strings
- I've tried string pooling instead of constantly allocating new strings, and it actually ends up being slower somehow
Code:
30 replies