1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:05:01 -07:00
go/src
Rémy Oudompheng 23093f86ee strings: better mean complexity for Count and Index.
The O(n+m) complexity is obtained probabilistically
by using Rabin-Karp algorithm, which provides the needed complexity
unless exceptional collisions occur, without memory allocation.

benchmark                 old ns/op    new ns/op    delta
BenchmarkIndexHard1         6532331      4045886  -38.06%
BenchmarkIndexHard2         8178173      4038975  -50.61%
BenchmarkIndexHard3         6973687      4042591  -42.03%
BenchmarkCountHard1         6270864      4071090  -35.08%
BenchmarkCountHard2         7838039      4072853  -48.04%
BenchmarkCountHard3         6697828      4071964  -39.20%
BenchmarkIndexTorture       2730546        28934  -98.94%
BenchmarkCountTorture       2729622        29064  -98.94%

Fixes #4600.

R=rsc, donovanhide, remyoudompheng
CC=golang-dev
https://golang.org/cl/7314095
2013-02-17 13:07:17 +01:00
..
cmd build: clang support 2013-02-15 13:37:43 -08:00
lib9 lib9: fix build for windows 2013-02-06 00:33:25 +08:00
libbio
libmach cmd/dist: add -Wstrict-prototypes to CFLAGS and fix all the compiler errors 2013-02-05 21:43:04 +08:00
pkg strings: better mean complexity for Count and Index. 2013-02-17 13:07:17 +01:00
all.bash
all.bat
all.rc
clean.bash
clean.bat
clean.rc
make.bash build: clang support 2013-02-15 13:37:43 -08:00
make.bat
Make.dist
make.rc
race.bash
race.bat src: add race.bat 2013-02-03 00:49:37 +08:00
run.bash build: clang support 2013-02-15 13:37:43 -08:00
run.bat
run.rc
sudo.bash