2 ms·
> how cache friendly is that backing store It's the original input buffer. It's less fragmented than creating small copies for every token. The backing store
by tgv 5y ago
> how cache friendly is that backing store
It's the original input buffer. It's less fragmented than creating small copies for every token. The backing store stays alive as long as there's a single token pointing to it. It's a bit inefficient if there's a lot of whitespace, comment, etc. in it, or if you're only interested in a very small portion of the tokens, but it doesn't have the overhead of a memory block per string (which is at least 16 bytes). So it depends, I guess.
I don't think dynamic dispatch comes into play in go. The strings are represented in the same way.