On 12/5/15 8:44 AM, Coroutines wrote:
What I want is to be able to view a String through a typed array
without duplicating the memory/contents of that string.

The big problem with this is that the actual in-memory representations of strings and arraybuffers can be quite different in implementations right now.

For example, strings typically have a complicated representation that involves multiple fragments, ropes, etc, to make string concatenation fast. Not only that, but to save memory in various engines some strings that only contain values less than 256 are stored with underlying 8-bit units, not 16-bit ones. There has also been talk of using something like UTF-8 for the internal string representation in some engines, to reduce the impedance mismatch with engine consumers (like a browser rendering engine).

Arraybuffers, on the other hand, are typically an actual contiguous chunk of memory to make access fast. And of course they just exposed whatever bytes they contain.

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to