• Alex Brainman's avatar
    runtime: change osyield to use Windows SwitchToThread · 1f5b1b2b
    Alex Brainman authored
    It appears that windows osyield is just 15ms sleep on my computer
    (see benchmarks below). Replace NtWaitForSingleObject in osyield
    with SwitchToThread (as suggested by Dmitry).
    
    Also add issue #14790 related benchmarks, so we can track perfomance
    changes in CL 20834 and CL 20835 and beyond.
    
    Update #14790
    
    benchmark                             old ns/op     new ns/op     delta
    BenchmarkChanToSyscallPing1ms         1953200       1953000       -0.01%
    BenchmarkChanToSyscallPing15ms        31562904      31248400      -1.00%
    BenchmarkSyscallToSyscallPing1ms      5247          4202          -19.92%
    BenchmarkSyscallToSyscallPing15ms     5260          4374          -16.84%
    BenchmarkChanToChanPing1ms            474           494           +4.22%
    BenchmarkChanToChanPing15ms           468           489           +4.49%
    BenchmarkOsYield1ms                   980018        75.5          -99.99%
    BenchmarkOsYield15ms                  15625200      75.8          -100.00%
    
    Change-Id: I1b4cc7caca784e2548ee3c846ca07ef152ebedce
    Reviewed-on: https://go-review.googlesource.com/21294
    Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
    Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
    Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    1f5b1b2b
os1_windows.go 19.4 KB