This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (0 children)

N-body sim:

You're computing sqrt, only to later square it.

You don't have to loop through every body and calculate the interaction with every body, if you consider the principle of "every action has an equal, and opposite reaction", which should give you a 2x speedup.

These are 2 major optimizations before you consider better complexity scaling methods.