Details
-
Enhancement
-
Resolution: Not an Issue
-
P4
-
None
-
None
Description
A common arithmetic pattern in java.time is to calculate both Math.floorDiv and floorMod for the same arguments. In such cases floorMod can be calculated more efficiently using the result of floorDiv.
From the javadoc for floorMod, the relationship is such that:
floorDiv(x, y) * y + floorMod(x, y) == x
or:
floorMod(x, y) == x - floorDiv(x, y) * y;
Replacing such floorMods bring a 10-15% speed-up on GetYearBench.
From the javadoc for floorMod, the relationship is such that:
floorDiv(x, y) * y + floorMod(x, y) == x
or:
floorMod(x, y) == x - floorDiv(x, y) * y;
Replacing such floorMods bring a 10-15% speed-up on GetYearBench.
Attachments
Issue Links
- links to
-
Review openjdk/jdk/8056