You should make a benchmarking script to track speed over time. I've written probably 10 different Verlet engines in JavaScript, and the overhead of JavaScript's dynamic nature can be very palpable in the simulations.
For my most recent attempt at something speedy, here's some source code making use of typed arrays and doing away with objects completely. The speed improvement is good, but maybe the maintainability suffers a little (press space to create blob):
https://c9.io/blixt/blob/workspace/index.html
Note that the particle-line collision is currently inefficient, so it slows down the simulation a lot more than it should.
Comments
You should make a benchmarking script to track speed over time. I've written probably 10 different Verlet engines in JavaScript, and the overhead of JavaScript's dynamic nature can be very palpable in the simulations.
For my most recent attempt at something speedy, here's some source code making use of typed arrays and doing away with objects completely. The speed improvement is good, but maybe the maintainability suffers a little (press space to create blob): https://c9.io/blixt/blob/workspace/index.html
Note that the particle-line collision is currently inefficient, so it slows down the simulation a lot more than it should.