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

SWinxy duke at openjdk.java.net
Fri May 6 03:50:29 UTC 2022


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 the array doesn't have to be sorted alphanumerically necessarily, and it creates the colors on demand.

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

Commit messages:
 - Merge identical branches in XColors switch search
 - Replace color search in XColors with a switch statement

Changes: https://git.openjdk.java.net/jdk/pull/7096/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7096&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286270
  Stats: 1302 lines in 1 file changed: 510 ins; 784 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7096.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7096/head:pull/7096

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



More information about the client-libs-dev mailing list