]> Cypherpunks repositories - gostls13.git/commit
strings: make IndexRune faster
authorHiroshi Ioka <hirochachacha@gmail.com>
Tue, 6 Sep 2016 11:23:40 +0000 (20:23 +0900)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 7 Sep 2016 01:03:10 +0000 (01:03 +0000)
commit8737dac1f27db2596f1d24aab8e5c942734c3bb4
tree6fc4c9cbaea2c7a846b047dbf4b83e467b5a9eaa
parenta4bdd645550608fdb39bfea0bb83eb39b95c6c0b
strings: make IndexRune faster

re-implement IndexRune by Index which is well optimized to get
performance gain.

name                   old time/op  new time/op  delta
IndexRune-4            30.2ns ± 1%  28.3ns ± 1%   -6.22%  (p=0.000 n=20+19)
IndexRuneLongString-4   156ns ± 1%    49ns ± 1%  -68.72%  (p=0.000 n=19+19)
IndexRuneFastPath-4    10.6ns ± 2%  10.0ns ± 1%   -6.30%  (p=0.000 n=18+18)

Change-Id: Ie663b8f7860ca51892dd4be182fca3caa5f8ae61
Reviewed-on: https://go-review.googlesource.com/28546
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/strings/strings.go
src/strings/strings_amd64.go
src/strings/strings_test.go