• Brad Fitzpatrick's avatar
    strings: implement a faster byte->byte Replacer · f75ff01f
    Brad Fitzpatrick authored
    When all old & new string values are single bytes,
    byteReplacer is now used, instead of the generic
    algorithm.
    
    BenchmarkGenericMatch       10000  102519 ns/op
    BenchmarkByteByteMatch    1000000    2178 ns/op
    
    fast path, when nothing matches:
    BenchmarkByteByteNoMatch  1000000    1109 ns/op
    
    comparisons to multiple Replace calls:
    BenchmarkByteByteReplaces  100000   16164 ns/op
    
    comparison to strings.Map:
    BenchmarkByteByteMap       500000    5454 ns/op
    
    R=rsc
    CC=golang-dev
    https://golang.org/cl/5175050
    f75ff01f
Name
Last commit
Last update
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...