3 ms·
Yeah and using byte buffers isn’t JavaScript array access. But it is for C. The n-body looks most like canonical JS to me. It’s a small array, but’s it’s acces
by tightbookkeeper 2y ago
Yeah and using byte buffers isn’t JavaScript array access. But it is for C.
The n-body looks most like canonical JS to me. It’s a small array, but’s it’s accessed many times.
Unfortunately the c++ version is simd optimized, so I don’t think that’s a fair comparison.
- igouy 2y agoThere are plain C++ programs: n-body C++ g++ #3 https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/nbody.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- jampekka 2y agoI'd guess using typed arrays or even normal arrays wouldn't slow the code much, and the slowdown will be probably a small constant factor. If the JIT detects the array as homogenous it will compile it to low level array access. JS JITs are very good.
- igouy 2y ago> I don’t think that’s a fair comparison Shouldn't simd use make it less likely JS would be within magnitude, so if compared against simd programs and the JS is still less than 10x slower then that strengthens jampekka's point?