Comment by btilly

4 years ago

If you're already using JavaScript for some other reasons but occasionally have bit twiddling, byte munching needs, then trying to do that in JavaScript makes perfect sense. Is it the fastest option? No. But according to https://benchmarksgame-team.pages.debian.net/benchmarksgame/... it is generally within a factor of 4-5 of C++.

For an application area where this applies, consider a web-based game. Using JavaScript keeps you from shipping another application. But occasionally you may have bit twiddling and/or byte munching needs. Which you need to do in JavaScript.

My point wasn't to say you should never do byte manipulation in Javascript, but that for these rare edge cases the existing capabilities without a native int are fine and if you would really need the native int rather than some equivalent work around (which I assume is most likely due to performance considerations) a faster language is the better approach. A webgame might be able to use wasm for that.