phetsims / charges-and-fields

"Charges And Fields" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
9 stars 7 forks source link

Performance optimization for ElectricPotentialLine #173

Open samreid opened 4 years ago

samreid commented 4 years ago

From https://github.com/phetsims/charges-and-fields/issues/171 @jonathanolson said:

Avoiding trigonometry for the perpendicular computation might help performance (e.g. -y, x in this case).

I replied:

There are 5 occurrences of normalize().rotate( Math.PI / 2 ), I'm also seeing many other opportunities for performance improvements by eliminating allocations.