On Tue, 14 Feb 2023 03:20:14 GMT, Sergey Kuksenko <skukse...@openjdk.org> wrote:
> The pr looks promising in terms of performance. What makes sense to do: > > *) Don't rely on external benchmarks. It's fine if such exists, but anyway > set of microbenchmarks (using JMH) will be much better. More clear, readable > results, etc. E.g., it may show that other operations (for example, sqrt) > were speeded up too. > > *) Find boundaries. "divideAndRemainder(bigTenToThe(scaleStep))" may produce > non-zero reminder. Find conditions when it happens. How big is performance > regression in such cases? > > Some other optimizations: *) Current code checks only the lowest bit (odd or > even) to cut off indivisible cases. Making > "divideAndRemainder(bigTenToThe(scaleStep))" - you make check scaleStep > lowest bits to do cut off. See "BigInteger.getLowestSetBit()" > > *) BigInteger division by int value is faster. It's a special case. What is > faster, doing the single division by bigTenToThe(scaleStep) or doing several > divisions (split scaleStep to fit into int)? Exploration is required. Good idea! Thanks. I will look into such cases and try to explore more. ------------- PR: https://git.openjdk.org/jdk/pull/12509