• Alex Brainman's avatar
    os: parse command line without shell32.dll · 39c8d2b7
    Alex Brainman authored
    Go uses CommandLineToArgV from shell32.dll to parse command
    line parameters. But shell32.dll is slow to load. Implement
    Windows command line parsing in Go. This should make starting
    Go programs faster.
    
    I can see these speed ups for runtime.BenchmarkRunningGoProgram
    
    on my Windows 7 amd64:
    name                old time/op  new time/op  delta
    RunningGoProgram-2  11.2ms ± 1%  10.4ms ± 2%  -6.63%  (p=0.000 n=9+10)
    
    on my Windows XP 386:
    name                old time/op  new time/op  delta
    RunningGoProgram-2  19.0ms ± 3%  12.1ms ± 1%  -36.20%  (p=0.000 n=10+10)
    
    on @egonelbre Windows 10 amd64:
    name                old time/op  new time/op  delta
    RunningGoProgram-8  17.0ms ± 1%  15.3ms ± 2%  -9.71%  (p=0.000 n=10+10)
    
    This CL is based on CL 22932 by John Starks.
    
    Fixes #15588.
    
    Change-Id: Ib14be0206544d0d4492ca1f0d91fac968be52241
    Reviewed-on: https://go-review.googlesource.com/37915Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    39c8d2b7
os_windows_test.go 20.8 KB