4 ms·
How would splitting it into substrings be different from decoding individual strings from an allocation/gc perspective? If anything I'd assume splitting a subst
by boomskats 1y ago
How would splitting it into substrings be different from decoding individual strings from an allocation/gc perspective? If anything I'd assume splitting a substring was more efficient - i expect there's a ton of optimisations in js for sliced strings or whatever as it's been around for ages.
- vanderZwan 1y agoI imagine it's faster during creation because there's fewer allocations for a backing array for the string content (one, basically, unless they move stuff around). But then that can also mean holding on to the entire backing array even if only one of the strings is still "alive", unless there are optimizations for reclaiming memory in those situations too.
- monster_truck 1y agoI'm pretty sure turbofan handles this, you might need to do a little hoisting or tagging