Skip to content

Conversation

@luckylsk34
Copy link

In convertRadiansToDegrees and convertDegreesToRadians methods, we are creating BigDecimals of PI/180 and 180/PI. These values have high precision and BigDecimal is too slow. We move these into a static variable to avoid repeated creations.

This change nets us about 50-66% speedup. The following table contains the testing on my machine.

Index Total Operations(ops) Total Time(s) Speed(ops/s) Speedup
Default 5,000,000 92 5.43E+04 1.00
Moved to Static Variables 5,000,000 55 9.09E+04 1.67

@luckylsk34 luckylsk34 marked this pull request as ready for review April 12, 2023 20:32
@luckylsk34
Copy link
Author

@mikereedell Hi Mike, please review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant