]> Cypherpunks repositories - gostls13.git/commit
bytes, strings: improve EqualFold fast version for ASCII
authorEric Pauley <eric@pauley.me>
Sun, 29 Apr 2018 04:15:03 +0000 (00:15 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 1 May 2018 18:52:19 +0000 (18:52 +0000)
commit9d11c63b64d1f29f43cfd7397614baa24c72a151
treeb716a94ccd9561dcb5162b746138dc9077903d46
parenta5b80d469a1d07f77067075f9cbff80f5edc2323
bytes, strings: improve EqualFold fast version for ASCII

The existing implementation only considers the special ASCII
case when the lower character is an upper case letter. This
means that most ASCII comparisons use unicode.SimpleFold even
when it is not necessary.

benchmark                old ns/op     new ns/op     delta
BenchmarkEqualFold-8     450           390           -13.33%

Change-Id: I735ca3c30fc0145c186d2a54f31fd39caab2c3fa
Reviewed-on: https://go-review.googlesource.com/110018
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/bytes/bytes.go
src/strings/strings.go
src/strings/strings_test.go