]> Cypherpunks repositories - gostls13.git/commit
strings: use Rabin-Karp algorithm for LastIndex.
authorRui Ueyama <ruiu@google.com>
Mon, 1 Sep 2014 07:47:57 +0000 (17:47 +1000)
committerNigel Tao <nigeltao@golang.org>
Mon, 1 Sep 2014 07:47:57 +0000 (17:47 +1000)
commit553378079522ca9f131c62acf9cc0a583c76164b
tree22e2432ebc84eb592682409b1ff9eb6b0f450b50
parent933169febb90b2a1551a09b5761fda75be9d964d
strings: use Rabin-Karp algorithm for LastIndex.

benchmark                  old ns/op     new ns/op     delta
BenchmarkSingleMatch       49443         52275         +5.73%
BenchmarkIndex             28.8          27.4          -4.86%
BenchmarkLastIndex         14.5          14.0          -3.45%
BenchmarkLastIndexHard1    3982782       2309200       -42.02%
BenchmarkLastIndexHard2    3985562       2287715       -42.60%
BenchmarkLastIndexHard3    3555259       2282866       -35.79%

LGTM=josharian, nigeltao
R=golang-codereviews, ality, josharian, bradfitz, dave, nigeltao, gobot, nightlyone
CC=golang-codereviews
https://golang.org/cl/102560043
src/pkg/strings/strings.go
src/pkg/strings/strings_test.go