On Thu, 22 Jun 2023 00:13:06 GMT, 温绍锦 <d...@openjdk.org> wrote:
>> By optimizing the implementation of java.lang.Long#fastUUID, the performance >> of the java.util.UUID#toString method can be significantly improved. >> >> The following are the test results of JMH: >> >> Benchmark Mode Cnt Score Error Units >> UUIDUtilsBenchmark.new thrpt 5 92676.550 ± 292.213 ops/ms >> UUIDUtilsBenchmark.original thrpt 5 37040.165 ± 1023.532 ops/ms > > 温绍锦 has updated the pull request incrementally with one additional commit > since the last revision: > > move HEX256 to LongCache Changes requested by liach (Author). About @Glavo's VH suggestion: I think it is feasible, since the VH field is not initialized until the method is used, so there should be no startup issue. On a side note, JDK itself has a `UUIDBench` that benchmarks toString as well: can run it with `make test TEST="micro:java.util.UUIDBench.toString"` once the configuration has JMH set up, which I will be using (against master and this patch) src/java.base/share/classes/java/lang/Long.java line 484: > 482: > 483: buf[off] = (byte) (i >> 8); > 484: buf[1 * charSize + off] = (byte) i; Suggestion: buf[off] = (byte) (i0 >> 8); buf[1 * charSize + off] = (byte) i0; Doesn't compile on my end ------------- PR Review: https://git.openjdk.org/jdk/pull/14578#pullrequestreview-1492220846 PR Comment: https://git.openjdk.org/jdk/pull/14578#issuecomment-1601915404 PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1237906554