This is old - but the most relevant thread I could find:

Any plans for a bytes.Replacer?

(the strings.Replacer is screaming fast, and it would be really nice to
have that speed in the bytes department too).

Bjørn Erik Pedersen

tirsdag 20. september 2011 01.38.50 UTC+2 skrev Brad Fitzpatrick følgende:
Reviewers: golang-dev_googlegroups.com,

Hello golan...@googlegroups.com <javascript:> (cc:
golan...@googlegroups.com <javascript:>),

I'd like you to review this change to

strings: add ReplacementMap

Faster way to apply multiple replacements against a string at
once, minimizing copies. With an optimized case for when all
the replacement source strings are single bytes.

strings_test.BenchmarkOldHTTPHTMLReplace 1000000 2918 ns/op
strings_test.BenchmarkReplaceMapSingleByte 1000000 1330 ns/op
strings_test.BenchmarkReplaceMap 500000 5240 ns/op

Please review this at http://codereview.appspot.com/5081042/

Affected files:
M src/pkg/http/cookie.go
M src/pkg/http/header.go
M src/pkg/http/server.go
M src/pkg/mime/multipart/writer.go
M src/pkg/strings/Makefile
A src/pkg/strings/replace.go
A src/pkg/strings/replace_test.go

You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
postedFeb 10, '15 at 8:20p
activeFeb 10, '15 at 8:20p

1 user in discussion

Bjørn Erik Pedersen: 1 post



site design / logo © 2021 Grokbase