4 ms·
StringBuilder in both JS and .Net has a class especially for this.
by Jerrrrrrry 2y ago
StringBuilder in both JS and .Net has a class especially for this.
- foxglacier 2y agoThat's for concatenating. He's splitting.
- Jerrrrrrry 2y agoSplitting, even if it's not re-concatenated (unlikely in practice) would still benefit from the cache-optimization/ lack of garbage collection overhead / consequential bytes in literal RAM, no?
- foxglacier 2y agoYea sounds bizarre but he observed that.
- theandrewbailey 2y agoI dug up where I used it. It was a bible in HTML and JS. At first, it was using arrays of arrays of strings (for chapters and verses), but I refactored it to really long strings for each book with those separators. The entire bible is one JSON object in the source, keyed by book and the values are those really long strings. https://raw.githubusercontent.com/theandrewbailey/OfflineBible/refs/heads/gh-pages/KJV.html https://raw.githubusercontent.com/theandrewbailey/OfflineBib... A StringBuilder wouldn't work, since there's nothing left to concatenate.