Substrings are garbage
Why 13 characters can occupy megabytes of browser memory?
4 min readSep 13, 2021
In JavaScript, a string length and its size in memory do not always correlate. I mentioned in my previous posts that in JavaScript, depending on their characteristics and origins, strings can be represented as several C++ classes that to save memory and thus CPU time. 1 MB of memory might suffice to store a repetitive…