4 ms·
You actually can lay things out in memory using Typed Arrays. There's some overhead to reads/writes though (there is memory safety, after all).
by crocodileJS 10y ago
You actually can lay things out in memory using Typed Arrays.
There's some overhead to reads/writes though (there is memory safety, after all).
- Klathmon 10y agoWhat's amazing is that in some engines, if the JIT can determine that you are within the bounds of the array, it can disable those checks for the duration of the loop. So something like for (x = 0; x < arr.length; x++) {...} can run at pretty much the same speed as C code.