EastsidePreparatorySchool / FusorComputationalModeling

Eastside Prep Fusor project electrostatic field modeling and deuteron simulation
2 stars 3 forks source link

performance: getSurfaceArea #31

Closed gunnarmein closed 7 years ago

gunnarmein commented 7 years ago

Every time we choose a random point, we compute the surface area of parts over and over again. That value needs to be cached. Here is one easy way:

guberti commented 7 years ago

Issues #30 to #33 look pretty simple, will write quick fixes for them tonight.

gunnarmein commented 7 years ago

I would use caution with #33. A mistake here would influence the math in an undetectable way.

gunnarmein commented 7 years ago

Didn't mean to close this.

guberti commented 7 years ago

Just ran a benchmark test to determine how shakeUpPoints runs right now. For my Bent Sphere JSON file (the realistic one), it takes 85.2493 seconds to perform 20 shake-up operations on 2000 total points. Note that the Bent Sphere JSON object includes a complex STL file.

guberti commented 7 years ago

After fixing #30, the operation described above takes 29.4334 seconds.

guberti commented 7 years ago

Just built a fix for this. No meaningful change in performance visible.

gunnarmein commented 7 years ago

Your stl file is not a great case for this fix. This one only matters when surface area involves more complex calculations, like the torus segment. Triangles are too simple. But, we may never have enough complex shapes for this to matter.