3 ms·
In SpiderMonkey, JavaScript strings turn into ropes based on some heuristics (if you append to them a lot, I think). This helps a few benchmarks. So while you
by pcwalton 13y ago
In SpiderMonkey, JavaScript strings turn into ropes based on some heuristics (if you append to them a lot, I think). This helps a few benchmarks.
So while you might think a JavaScript string is just a pointer + length, the implementation is actually significantly more complex: the engine will pick different implementations depending on how it thinks you're using it.
- mccr8 13y agoThe whole hierarchy of SpiderMonkey strings is laid out in this comment in the code: http://mxr.mozilla.org/mozilla-central/source/js/src/vm/String.h#88 http://mxr.mozilla.org/mozilla-central/source/js/src/vm/Stri...