RFR: 8318709: Improve System.nanoTime performance on Windows

Daniel Jeliński djelinski at openjdk.org
Tue Oct 24 10:10:44 UTC 2023


- use LARGE_INTEGER.QuadPart instead of assembling the jlong from high/low parts
- precalculate counts_per_nano to avoid costly floating-point division in counter to nanosecond conversion

Benchmark before:
SystemTime.nanoTime                avgt   15  19,366 � 0,383  ns/op

After:
SystemTime.nanoTime                avgt   15  15,812 � 0,385  ns/op

Tier1-2 clean.

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

Commit messages:
 - Improve nanoTime performance

Changes: https://git.openjdk.org/jdk/pull/16336/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16336&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318709
  Stats: 16 lines in 1 file changed: 1 ins; 9 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/16336.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16336/head:pull/16336

PR: https://git.openjdk.org/jdk/pull/16336


More information about the hotspot-runtime-dev mailing list