RFR: 8286271: [java.desktop] Replace ternary operators with java.lang.Math min/max

Laurent Bourgès lbourges at openjdk.java.net
Fri May 6 16:03:58 UTC 2022


On Sat, 15 Jan 2022 04:23:33 GMT, SWinxy <duke at openjdk.java.net> wrote:

> Delete `sun.java2d.marlin.FloatMath` class in favor of methods in `java.lang.Math`. The methods in `Math.java` are intrinsics and can gain from significant speedups. Hand-written min/max operations are also replaced with calls. 5 uses of `ceil` and 2 uses of `floor` were replaced.
> This should not cause any rendering differences from the different algorithms being used, as they theoretically will end up at the same outcomes.

Thanks for your detailed analysis, it matches my variant, so I prefer keeping FloatMath with fewer methods.
I agree min/max can use jdk math as I manually inlined important calls inside very hot loops in Renderer.

Here is my latest version of FloatMath (jdk branch):
https://github.com/bourgesl/marlin-renderer/blob/jdk/src/main/java/sun/java2d/marlin/FloatMath.java

Marlin renderer 0.9.4.5 has few more patches that I have to propose to openjdk/jdk as I did for openjfx:
https://github.com/openjdk/jfx/pull/674

Thanks

-------------

PR: https://git.openjdk.java.net/jdk/pull/7097



More information about the client-libs-dev mailing list