]> Cypherpunks repositories - gostls13.git/commit
runtime: use RtlGenRandom instead of CryptGenRandom
authorAlex Brainman <alex.brainman@gmail.com>
Mon, 26 Sep 2016 06:44:35 +0000 (16:44 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 28 Sep 2016 05:21:53 +0000 (05:21 +0000)
commitdb82cf4e506938a36a57a64dbe1f79eb0365ea89
tree53e941982f3a969337c29192910f0326a7a0bea3
parent98938189a16a764007bce7fcd4bfeb2386043208
runtime: use RtlGenRandom instead of CryptGenRandom

This change replaces the use of CryptGenRandom with RtlGenRandom in
Windows to generate cryptographically random numbers during process
startup. RtlGenRandom uses the same RNG as CryptGenRandom, but it has many
fewer DLL dependencies and so does not affect process startup time as
much.

This makes running simple Go program on my computers faster.

Windows XP:
benchmark                      old ns/op     new ns/op     delta
BenchmarkRunningGoProgram-2     47408573      10784148      -77.25%

Windows 7 (VM):
benchmark                    old ns/op     new ns/op     delta
BenchmarkRunningGoProgram     16260390      12792150      -21.33%

Windows 7:
benchmark                      old ns/op     new ns/op     delta
BenchmarkRunningGoProgram-2     13600778      10050574      -26.10%

Fixes #15589

Change-Id: I2816239a2056e3d4a6dcd86a6fa2bb619c6008fe
Reviewed-on: https://go-review.googlesource.com/29700
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/os_windows.go
src/runtime/syscall_windows_test.go