Descriptionstrings: 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 issue 4600.
Patch Set 1 #Patch Set 2 : diff -r aceba1ebb946 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r aceba1ebb946 https://go.googlecode.com/hg/ #
Total comments: 14
Patch Set 4 : diff -r 3836bcbafa69 https://go.googlecode.com/hg/ #
Total comments: 2
Patch Set 5 : diff -r 0adf91947752 https://go.googlecode.com/hg/ #Patch Set 6 : diff -r 0adf91947752 https://go.googlecode.com/hg/ #MessagesTotal messages: 11
|