big-math
big-math copied to clipboard
Performance issue in BigDecimalMath.pow()
The BigDecimalMath.pow()
method is relying on Exception handling to recover from some corner cases.
In my profiling the BigDecimal.longValueExcact()
can throw ArithmeticException("Rounding necessary")
which takes a large chunk of the BigDecimalMath.pow()
execution time. The time is X axis on the flame graph below - roughly 50%?
The issue seem to be with try/catch code below and I wonder if the exception could be mitigated with some conditions inside try/catch to avoid some common cases of the ArithmeticException
?