• Eric Roshan-Eisner's avatar
    strings: implement a faster single-string Replacer · 631a0e71
    Eric Roshan-Eisner authored
    The string searching is implemented separately so other functions
    may make use of it in the future.
    
    benchmark                        old ns/op    new ns/op    delta
    BenchmarkSingleMaxSkipping          125889         2474  -98.03%
    BenchmarkSingleLongSuffixFail        16252         1996  -87.72%
    BenchmarkSingleMatch                260793       136266  -47.75%
    
    benchmark                         old MB/s     new MB/s  speedup
    BenchmarkSingleMaxSkipping           79.43      4041.57   50.88x
    BenchmarkSingleLongSuffixFail        61.65       501.81    8.14x
    BenchmarkSingleMatch                 57.52       110.08    1.91x
    
    R=nigeltao
    CC=golang-dev
    https://golang.org/cl/6545049
    631a0e71
replace_test.go 12 KB