]> Cypherpunks repositories - gostls13.git/commit
strings: lower running time of TestCompareStrings
authorKeith Randall <keithr@alum.mit.edu>
Sun, 4 Nov 2018 05:57:52 +0000 (22:57 -0700)
committerKeith Randall <khr@golang.org>
Sun, 4 Nov 2018 18:55:55 +0000 (18:55 +0000)
commit4bb9b61677e937d1f473c27607da3608d0fa7099
tree2ebab9cf02b0a4d153e32295fe7cfc084f72a25d
parent6fe8ee78e9b4870ebc1de2b5cfd6170a78a56c00
strings: lower running time of TestCompareStrings

At each comparison, we're making a copy of the whole string.
Instead, use unsafe to share the string backing store with a []byte.

It reduces the test time from ~4sec to ~1sec on my machine
(darwin/amd64).  Some builders were having much more trouble with this
test (>3min), it may help more there.

Fixes #26174
Fixes #28573
Fixes #26155
Update #26473

Change-Id: Id5856fd26faf6ff46e763a088f039230556a4116
Reviewed-on: https://go-review.googlesource.com/c/147358
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/strings/compare_test.go