Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strings: optimize Replace #7617

Closed
rui314 opened this issue Mar 24, 2014 · 3 comments
Closed

strings: optimize Replace #7617

rui314 opened this issue Mar 24, 2014 · 3 comments
Milestone

Comments

@rui314
Copy link
Member

rui314 commented Mar 24, 2014

What does 'go version' print?
go version devel +62052ebe728b Sun Mar 23 18:58:35 2014 -0700 linux/amd64

We have a patch to improve performance of string.Replace by adding a fast path
(https://golang.org/cl/79200044). We cannot commit this now because of the
feature freeze for Go 1.3. Needs to be reviewed after 1.3.

This is a benchmark result of the patch:

benchmark                        old ns/op    new ns/op    delta
BenchmarkGenericNoMatch               2691          774  -71.24%
BenchmarkGenericMatch1                7920         8151   +2.92%
BenchmarkGenericMatch2               52336        39927  -23.71%
BenchmarkSingleMaxSkipping            1575         1575   +0.00%
BenchmarkSingleLongSuffixFail         1429         1429   +0.00%
BenchmarkSingleMatch                 56228        55444   -1.39%
BenchmarkByteByteNoMatch               568          568   +0.00%
BenchmarkByteByteMatch                 977          972   -0.51%
BenchmarkByteStringMatch              1669         1687   +1.08%
BenchmarkHTMLEscapeNew                 422          422   +0.00%
BenchmarkHTMLEscapeOld                 692          670   -3.18%
BenchmarkByteByteReplaces             8492         8474   -0.21%
BenchmarkByteByteMap                  2817         2808   -0.32%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkSingleMaxSkipping         6345.25      6346.76    1.00x
BenchmarkSingleLongSuffixFail       700.85       700.85    1.00x
BenchmarkSingleMatch                266.77       270.54    1.01x
@mikioh
Copy link
Contributor

mikioh commented Mar 24, 2014

Comment 1:

Labels changed: added repo-main, release-go1.4.

@ccahoon
Copy link
Contributor

ccahoon commented Jul 23, 2014

Comment 2:

I believe this issue could have been closed by revision a58e16be34cb.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Thanks for the note.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants