3 ms·
Nifty, but unfortunately we're still kinda limited to 32-bit addressing in typed arrays. It'd be nice if JS had an actual integer type that went up to 64 bits.
by angersock 12y ago
Nifty, but unfortunately we're still kinda limited to 32-bit addressing in typed arrays. It'd be nice if JS had an actual integer type that went up to 64 bits.
- azakai 12y ago32-bit is enough for a 4GB typed array, which doesn't seem too bad. I imagine eventually it will be limiting, but not in the near future.
- AceJohnny2 12y ago32-bits should be enough for everyone! Sorry, I couldn't help myself ;) (and I know your "not in the near future" makes the comparison incorrect anyhow)
- Dylan16807 12y agoThing is it's easy to need more than XX bits of stuff total, it's a lot rarer to want that in a single array in a high level language.
- userbinator 12y ago32-bit CPUs lasted for several decades in desktop computers, and I don't see it going away anytime soon. Personally, I think a lot of what average users are using computers for at the moment wouldn't need anything more than that. In most cases, 4GB is still a lot of memory... but it's easy to waste.
- angersock 12y agoI mean, the super gnarly thing here is eventually emulating an MMU in JS, right? Like, this almost gets us back to the nastiness of segmented memory models--you end up having the 32-bit addressable typed array as the "physical" memory, and then has the VMMU (virtual memory-management unit?) handle mapping from a virtual address (maybe a string?) to one of the physical addresses, and handling pagefaults. Actually, that sounds kind of sexy, if anyone wants to bullshit on a PoC hack, shoot me an email.
- RussianCow 12y agoReminds me of this talk by Gary Bernhardt: https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- tjgq 12y agoI'm not sure what the typed array limitations are, but Javascript numbers are able to exactly represent integers up to 2^53 - 1, which is quite a bit more than 32 bits.
- thomasfoster96 12y agoI think 64 bit integers in Typed Arrays are harder to implement than the other typed arrays already in Javascript. The highest integer you can safely work with in Javascript is 32 bits (using the ( number | 0 ) trick ) and so I wouldn't think it's just a coincidence that there isn't 64 bit integer arrays. I hold out hope for ES7 or ES8 to have them though - especially when SIMD.js comes about.