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

2022-05-05 Thread SWinxy
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 no

RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement

2022-05-05 Thread SWinxy
The current implementation creates ~750 new objects on load, and uses a binary array search with a Comparable implementation. This implementation is probably bad. Instead, we can use the enhanced switch feature to possibly save time, resources, and code size. The new implementation means that th

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

2022-05-05 Thread SWinxy
On Sat, 15 Jan 2022 04:23:33 GMT, SWinxy 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 > call

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement

2022-05-05 Thread SWinxy
On Sat, 15 Jan 2022 03:44:17 GMT, SWinxy wrote: > The current implementation creates ~750 new objects on load, and uses a > binary array search with a Comparable implementation. This implementation is > probably bad. Instead, we can use the enhanced switch feature to possibly &g

RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
The old java.desktop package needs dusting off. It hasn't been kept up to pace with the Java language, but it should. The purpose of this PR is to replace most or all `instanceof` checks with the new `instanceof` with a variable. Some methods that used `instanceof` were also reworked alongside t

Re: RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
On Fri, 4 Feb 2022 09:28:55 GMT, Julian Waters wrote: > Try to merge instead of rebasing and force-pushing, it helps with later > reviews. Good to know. I'm not a git master, and the purpose of the force push was to consolidate some missed changes into a single commit, but I know it can mess u

Re: RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
On Fri, 6 May 2022 03:05:30 GMT, Julian Waters wrote: >> Keeping open. > > @SWinxy Gratz on getting the contributor status! I've created an issue on the > tracker for you, please rename the title of this PR to just 8286269 and the > automated system should take care of

Re: RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
On Sat, 8 Jan 2022 18:13:45 GMT, SWinxy wrote: > The old java.desktop package needs dusting off. It hasn't been kept up to > pace with the Java language, but it should. The purpose of this PR is to > replace most or all `instanceof` checks with the new `instanceof` with a &g

Re: RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
On Fri, 6 May 2022 03:53:50 GMT, Julian Waters wrote: > No problems mate, this was what I faced too when joining as a contributor, so > I know how it feels ;) Then I should pass the wisdom on. (I also fixed the conflict from the web view rather than having to go into my IDE, which must be new.

Re: RFR: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-05 Thread SWinxy
On Sat, 8 Jan 2022 18:13:45 GMT, SWinxy wrote: > The old java.desktop package needs dusting off. It hasn't been kept up to > pace with the Java language, but it should. The purpose of this PR is to > replace most or all `instanceof` checks with the new `instanceof` with a &g

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

2022-05-06 Thread SWinxy
On Sat, 15 Jan 2022 04:23:33 GMT, SWinxy 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 > call

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

2022-05-06 Thread SWinxy
On Sat, 15 Jan 2022 04:23:33 GMT, SWinxy 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 > call

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

2022-05-06 Thread SWinxy
On Fri, 6 May 2022 16:52:47 GMT, Laurent Bourgès 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

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

2022-05-14 Thread SWinxy
On Sat, 15 Jan 2022 04:23:33 GMT, SWinxy 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 > call

Withdrawn: 8286269: [java.desktop] Use newer instanceof language feature wherever possible

2022-05-14 Thread SWinxy
On Sat, 8 Jan 2022 18:13:45 GMT, SWinxy wrote: > The old java.desktop package needs dusting off. It hasn't been kept up to > pace with the Java language, but it should. The purpose of this PR is to > replace most or all `instanceof` checks with the new `instanceof` with a &g

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement [v2]

2022-05-14 Thread SWinxy
plementation means that the > array doesn't have to be sorted alphanumerically necessarily, and it creates > the colors on demand. SWinxy has updated the pull request incrementally with one additional commit since the last revision: Remove @author tags per request -

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement [v2]

2022-05-14 Thread SWinxy
On Sun, 8 May 2022 02:44:16 GMT, Phil Race wrote: >> SWinxy has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Remove @author tags per request > > src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/XCo

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement [v2]

2022-05-14 Thread SWinxy
On Mon, 9 May 2022 20:21:21 GMT, Phil Race wrote: >>> > The current implementation creates ~750 new objects on load >>> >>> Whereas yours creates an un-bounded number .. and changes that two lookups >>> for the same name will return the same "==" object. >> >> That’s not what happens, since `X

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement [v3]

2022-05-19 Thread SWinxy
plementation means that the > array doesn't have to be sorted alphanumerically necessarily, and it creates > the colors on demand. SWinxy has updated the pull request incrementally with one additional commit since the last revision: Accidental mergers. I created a quick check to

Re: RFR: 8286270: [java.desktop] Replace color search in XColors with a switch statement [v2]

2022-05-19 Thread SWinxy
On Sat, 14 May 2022 17:33:37 GMT, SWinxy wrote: >> The current implementation creates ~750 new objects on load, and uses a >> binary array search with a Comparable implementation. This implementation is >> probably bad. Instead, we can use the enhanced switch feature to poss