
Strings Are Evil - rbanffy
https://dev.to/indy_singh_uk/strings-are-evil-9f9
======
choeger
The memory cost of these abstractions is staggering. Runtine seems ok, though.
What does that teach us?

~~~
dpark
What it teaches us is that looking at allocated memory is the wrong way to go.
Peak working set was reduced by only 4MB from V1 to V11. The speed difference
from V1 to V11 is <2 seconds and from V2 to V11 it's only 140ms.

It's not clear that rewriting the entire program without the benefit of Int
and Decimal parsing, without StreamReader, etc. is at all a net gain. ~60
lines of code ballooned to probably a few hundred. Obvious code was replaced
with much more complex code that is far more likely to contain latent bugs.

All this provided no significant improvement in working set or speed. All it
did was avoid gen-0 GC, which is very clearly not a significant bottleneck
here. Gen-0 GC essentially _is_ an ArrayPool. It's extremely cheap to free
data here.

------
keithalewis
TL;DR IOWs, you need to understand how computers work.

~~~
scotty79
To save allocations while file parsing drop # from C#

