10 karma · joined February 9, 2017
As for K-12, is that really a requirement in some places, or is it just the case that some clients just happen to not be updated?
There's some overhead to reads/writes though (there is memory safety, after all).
x = bodies_x[body_index]
versus
x = bodies[body_index].x
The "issue" with the nbody benchmark from the benchmarks game is that there's only four bodies, making this SOA-style approach have little payoff.
It would be great if you could do such a test, but with a significantly larger amount of bodies.
Predicting what sort of Javascript turns into what kind of native code on different JIT implementations is far from simple, too.
Even if in theory, an equivalent result should be possible in some cases, it's unrealistic to expect that in practice.