16 bits per char in strings?
mweidner037 opened this issue · comments
mweidner037 commented
DOMStrings are officially arrays of uint16's (even if not valid UTF-16): https://developer.mozilla.org/en-US/docs/Web/API/DOMString
So in situations where we convert byte arrays to strings so we can use them as map keys (e.g. AddWinsCSet), perhaps we can stuff 2 bytes per char instead of just 1, possibly reducing memory usage.
mweidner037 commented
Sounds like browsers already do this for us (at least V8 (Chrome/Node) and Firefox):
https://blog.mozilla.org/javascript/2014/07/21/slimmer-and-faster-javascript-strings-in-firefox/
https://stackoverflow.com/questions/40512393/understanding-string-heap-size-in-javascript-v8