Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5899)

Issue 6545049: code review 6545049: strings: implement a faster single-string Replacer (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by Eric Roshan Eisner
Modified:
11 years, 7 months ago
Reviewers:
nigeltao
CC:
nigeltao, golang-dev
Visibility:
Public.

Description

strings: implement a faster single-string Replacer 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

Patch Set 1 #

Patch Set 2 : diff -r 7cbb8aa08f8e https://code.google.com/p/go #

Patch Set 3 : diff -r 7cbb8aa08f8e https://code.google.com/p/go #

Total comments: 5

Patch Set 4 : diff -r 7cbb8aa08f8e https://code.google.com/p/go #

Total comments: 2

Patch Set 5 : diff -r d4627113a3e9 https://code.google.com/p/go #

Total comments: 10

Patch Set 6 : diff -r c9b56bb76d08 https://code.google.com/p/go #

Patch Set 7 : diff -r c9b56bb76d08 https://code.google.com/p/go #

Total comments: 7

Patch Set 8 : diff -r debb590074da https://code.google.com/p/go #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+330 lines, -8 lines) Patch
M src/pkg/strings/export_test.go View 1 1 chunk +9 lines, -0 lines 0 comments Download
M src/pkg/strings/replace.go View 1 2 3 4 5 5 chunks +73 lines, -7 lines 0 comments Download
M src/pkg/strings/replace_test.go View 1 3 chunks +34 lines, -1 line 0 comments Download
A src/pkg/strings/search.go View 1 2 3 4 5 6 7 1 chunk +124 lines, -0 lines 2 comments Download
A src/pkg/strings/search_test.go View 1 2 3 4 5 6 7 1 chunk +90 lines, -0 lines 1 comment Download

Messages

Total messages: 13
Eric Roshan Eisner
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
11 years, 7 months ago (2012-09-21 01:19:34 UTC) #1
nigeltao
Can we have before/after benchmark numbers? https://codereview.appspot.com/6545049/diff/4001/src/pkg/strings/replace.go File src/pkg/strings/replace.go (right): https://codereview.appspot.com/6545049/diff/4001/src/pkg/strings/replace.go#newcode366 src/pkg/strings/replace.go:366: var buf []byte ...
11 years, 7 months ago (2012-09-21 02:00:23 UTC) #2
nigeltao
Can we have before/after benchmark numbers?
11 years, 7 months ago (2012-09-21 02:00:30 UTC) #3
Eric Roshan Eisner
On 2012/09/21 02:00:23, nigeltao wrote: > Can we have before/after benchmark numbers? Added to cl ...
11 years, 7 months ago (2012-09-21 05:00:34 UTC) #4
mtj1
Is 50.88x the record? On Fri, Sep 21, 2012 at 1:00 AM, <eric.d.eisner@gmail.com> wrote: > ...
11 years, 7 months ago (2012-09-21 06:03:04 UTC) #5
nigeltao
http://codereview.appspot.com/6545049/diff/4001/src/pkg/strings/search.go File src/pkg/strings/search.go (right): http://codereview.appspot.com/6545049/diff/4001/src/pkg/strings/search.go#newcode18 src/pkg/strings/search.go:18: Make the blank line a // line, so the ...
11 years, 7 months ago (2012-09-25 12:18:37 UTC) #6
Eric Roshan Eisner
On Tue, Sep 25, 2012 at 5:18 AM, <nigeltao@golang.org> wrote: > > http://codereview.appspot.com/6545049/diff/4001/src/pkg/strings/search.go > File ...
11 years, 7 months ago (2012-09-25 14:50:18 UTC) #7
nigeltao
http://codereview.appspot.com/6545049/diff/14001/src/pkg/strings/replace.go File src/pkg/strings/replace.go (right): http://codereview.appspot.com/6545049/diff/14001/src/pkg/strings/replace.go#newcode354 src/pkg/strings/replace.go:354: // one string to replace (and that string has ...
11 years, 7 months ago (2012-09-26 10:49:32 UTC) #8
Eric Roshan Eisner
PTAL On 2012/09/26 10:49:32, nigeltao wrote: > http://codereview.appspot.com/6545049/diff/14001/src/pkg/strings/replace.go > File src/pkg/strings/replace.go (right): > > http://codereview.appspot.com/6545049/diff/14001/src/pkg/strings/replace.go#newcode354 ...
11 years, 7 months ago (2012-09-26 15:43:15 UTC) #9
nigeltao
https://codereview.appspot.com/6545049/diff/18002/src/pkg/strings/search.go File src/pkg/strings/search.go (right): https://codereview.appspot.com/6545049/diff/18002/src/pkg/strings/search.go#newcode17 src/pkg/strings/search.go:17: // and the rightmost occurence of b in pattern. ...
11 years, 7 months ago (2012-09-27 07:16:40 UTC) #10
Eric Roshan Eisner
On 2012/09/27 07:16:40, nigeltao wrote: > https://codereview.appspot.com/6545049/diff/18002/src/pkg/strings/search.go > File src/pkg/strings/search.go (right): > > https://codereview.appspot.com/6545049/diff/18002/src/pkg/strings/search.go#newcode17 > ...
11 years, 7 months ago (2012-09-27 15:24:19 UTC) #11
nigeltao
LGTM. Submitting... https://codereview.appspot.com/6545049/diff/14002/src/pkg/strings/search.go File src/pkg/strings/search.go (right): https://codereview.appspot.com/6545049/diff/14002/src/pkg/strings/search.go#newcode76 src/pkg/strings/search.go:76: // lastPrefix is the shift, and (last-i) ...
11 years, 7 months ago (2012-09-28 02:32:57 UTC) #12
nigeltao
11 years, 7 months ago (2012-09-28 02:34:40 UTC) #13
*** Submitted as http://code.google.com/p/go/source/detail?r=0a0a751f0b74 ***

strings: implement a faster single-string Replacer

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
http://codereview.appspot.com/6545049

Committer: Nigel Tao <nigeltao@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b