I'm storing a very large ( >1MB ) bitmask in memory as a string and am curious about how JS stores strings internally. I have the feeling, based on the fact that
String.fromCharCode( 65535 ).charCodeAt( 0 ) === 65535
, that all strings are unicode, but I'm not certain. Basically I'm trying to find out if it would be more efficient, in terms of memory usage, to bitmask against 16-bit characters than 8-bit characters?
Check this out:
https://developer.mozilla.org/en-US/docs/Mozilla_internal_string_guide#IDL_String_types
I believe it is very very browser dependent but the Mozilla documentation sheds some light on how they do it internally for JS strings.
The short answer is they use UTF-16
http://en.wikipedia.org/wiki/UTF-16
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With