]> Cypherpunks repositories - gostls13.git/commit
strings: reduce allocation in byteStringReplacer.WriteString
authorRui Ueyama <ruiu@google.com>
Thu, 19 Jun 2014 18:22:50 +0000 (11:22 -0700)
committerRui Ueyama <ruiu@google.com>
Thu, 19 Jun 2014 18:22:50 +0000 (11:22 -0700)
commit1ca10de35d289346468a9c5b26475265c375eb95
treee0cfbb65d5e40cd99eb7931eb08789ec0b640fa6
parent57964db3cb2ec2f3cbb1011a17a8c71d9d2c5b07
strings: reduce allocation in byteStringReplacer.WriteString

Use WriteString instead of allocating a byte slice as a
buffer. This was a TODO.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriteString        40139        19991  -50.20%

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107190044
src/pkg/strings/replace.go
src/pkg/strings/replace_test.go