Comment

Comment by strainer

I think there is no js version implemented which accesses the bodies parameters like this:

x = body.x[body_index]

I expect this should be much faster than accessing them like this:

x = body.[body_index].x

Because the latter requires pointer-from-property calculation for every single values access (which must be somehow optimised)

The former just requires pointer-from-property calculation for every array (not element) involved in the nbody loops, the individual element|values are picked out by array addressing which is inherently much simpler than property access.

I've used this method for nbody physics. I can modify a test to it and push to the repo.

parent strainer 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton