]> Cypherpunks repositories - gostls13.git/commit
testing: use QueryPerformanceCounter on Windows
authorEgon Elbre <egonelbre@gmail.com>
Mon, 22 Jan 2024 07:31:43 +0000 (09:31 +0200)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 26 Apr 2024 22:55:25 +0000 (22:55 +0000)
commit1c4704991aeae5c9e0c6816a227390829b724ab5
treeb3dcbd4803d301f2326480aafdd5dc376855ae23
parent9effeeab27de2a8f75a1050ce879ba8db3abb406
testing: use QueryPerformanceCounter on Windows

Windows time.Now granularity is around 0.5ms on modern systems,
which introduces a significant noise into benchmark results.
Instead of relying time.Now use QueryPerformanceCounter, which
has significantly better granularity compared to time.Now.

 │ TimeNow-32  │        HighPrecisionTimeNow-32        │
 │   sec/op    │    sec/op     vs base                 │
   4.812n ± 0%   30.580n ± 0%  +535.43% (p=0.000 n=20)

Fixes #31160

Change-Id: Ib2a574d638c9c6762a2524212def02265574e267
Reviewed-on: https://go-review.googlesource.com/c/go/+/557315
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/internal/syscall/windows/syscall_windows.go
src/runtime/os_windows.go
src/testing/benchmark.go
src/testing/export_test.go
src/testing/fuzz.go
src/testing/testing.go
src/testing/testing_other.go
src/testing/testing_windows.go
src/testing/testing_windows_test.go [new file with mode: 0644]