RFR: 8318709: Improve System.nanoTime performance on Windows

David Holmes dholmes at openjdk.org
Thu Oct 26 06:36:30 UTC 2023


On Tue, 24 Oct 2023 08:23:01 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> - 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.

Hmm that blog ends with:

> Exercise: Why are the LARGE_INTEGER and ULARGE_INTEGER structures not affected? 

And I'd like to know why we do not have the same alignment issue? (This all seems rather hackish but presumably their library guys get the okay from their compiler guys ... though I wonder then about folk trying to build the Windows code with gcc?

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

PR Comment: https://git.openjdk.org/jdk/pull/16336#issuecomment-1780495822


More information about the hotspot-runtime-dev mailing list