Skip to content

Conversation

@zigo101
Copy link
Contributor

@zigo101 zigo101 commented Jun 14, 2018

name old time/op new time/op delta
Repeat/5x1-4 95.9ns ± 2% 70.1ns ± 2% -26.93% (p=0.000 n=9+10)
Repeat/5x2-4 146ns ± 3% 100ns ± 2% -31.99% (p=0.000 n=10+10)
Repeat/5x6-4 203ns ± 3% 140ns ± 4% -30.77% (p=0.000 n=10+10)
Repeat/10x1-4 139ns ± 3% 92ns ± 4% -34.08% (p=0.000 n=10+10)
Repeat/10x2-4 188ns ± 4% 122ns ± 2% -35.34% (p=0.000 n=10+10)
Repeat/10x6-4 264ns ± 5% 179ns ± 4% -32.15% (p=0.000 n=10+10)

name old alloc/op new alloc/op delta
Repeat/5x1-4 10.0B ± 0% 5.0B ± 0% -50.00% (p=0.000 n=10+10)
Repeat/5x2-4 32.0B ± 0% 16.0B ± 0% -50.00% (p=0.000 n=10+10)
Repeat/5x6-4 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10)
Repeat/10x1-4 32.0B ± 0% 16.0B ± 0% -50.00% (p=0.000 n=10+10)
Repeat/10x2-4 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10)
Repeat/10x6-4 128B ± 0% 64B ± 0% -50.00% (p=0.000 n=10+10)

benchmark                       old ns/op     new ns/op     delta
BenchmarkRepeat/length-1-4      290           225           -22.41%
BenchmarkRepeat/length-5-4      621           391           -37.04%
BenchmarkRepeat/length-10-4     900           556           -38.22%

benchmark                       old allocs     new allocs     delta
BenchmarkRepeat/length-1-4      2              1              -50.00%
BenchmarkRepeat/length-5-4      2              1              -50.00%
BenchmarkRepeat/length-10-4     2              1              -50.00%
@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Jun 14, 2018
@zigo101 zigo101 changed the title Implement Repeat with Builder to avoid one unnecessary allocation. strings: Implement Repeat with Builder to avoid one unnecessary allocation. Jun 14, 2018
@gopherbot
Copy link
Contributor

This PR (HEAD: c1ad6e7) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/#/c/go/+/118855 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@zigo101 zigo101 changed the title strings: Implement Repeat with Builder to avoid one unnecessary allocation. strings: implement Repeat with Builder to avoid one unnecessary allocation. Jun 14, 2018
@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit Bot:

Uploaded patch set 2: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Brad Fitzpatrick:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit Bot:

Uploaded patch set 3: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit Bot:

Uploaded patch set 4: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Ilya Tocar:

Patch Set 4:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 3d2e842) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/#/c/go/+/118855 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gerrit Bot:

Uploaded patch set 6: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Tapir Liu:

Patch Set 6:

Patch Set 4:

(2 comments)

yes, it was benchcmp. Switched to benchstat now.

The outer loop is removed now.

Thanks.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot gopherbot force-pushed the master branch 14 times, most recently from 4016de0 to d2f663c Compare July 18, 2018 19:56
@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 12: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 13: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 14: New patch set was added with same tree, parent, and commit message as Patch Set 13.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16006:

Patch Set 14:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@bradfitz bradfitz changed the title strings: implement Repeat with Builder to avoid one unnecessary allocation. strings: use Repeat in Builder to avoid an allocation Aug 21, 2018
@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 15: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 16: New patch set was added with same tree, parent, and commit message as Patch Set 15.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@bradfitz bradfitz changed the title strings: use Repeat in Builder to avoid an allocation strings: use Builder in Repeat to avoid an allocation Aug 21, 2018
@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 17: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 17: Code-Review+2

I tweaked the PR title on GitHub.

I'm happy with this when Martin's happy with the benchmarks.

I'd try to keep the benchmarks names short-ish if possible. Maybe even like:

Repeat/1x4
Repeat/5x4
Repeat/10x4

etc


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16006:

Patch Set 17:

length times count

Repeat/5x1
Repeat/5x2
Repeat/5x6
Repeat/10x1
Repeat/10x2
Repeat/10x6

or for just counts

Repeat/1
Repeat/2
Repeat/6
sounds both good to me.

Would be good to keep the number of sub benchmarks within reason e.g. 6 or so.

Otherwise code looks good.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 18: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 18:

Please change code & commit message both to benchmarks named in "NxM" style.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 18:

(7 comments)

Patch Set 18:

Please change code & commit message both to benchmarks named in "NxM" style.

ok, will do it tomorrow.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 19: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 20: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 19:

(2 comments)

Patch Set 17:

length times count

Repeat/5x1
Repeat/5x2
Repeat/5x6
Repeat/10x1
Repeat/10x2
Repeat/10x6

or for just counts

Repeat/1
Repeat/2
Repeat/6
sounds both good to me.

Would be good to keep the number of sub benchmarks within reason e.g. 6 or so.

Otherwise code looks good.

Benchmark will be the following one by newest reviewings.

func BenchmarkRepeat(b *testing.B) {
s := "0123456789"
for _, n := range []int{5, 10} {
for _, c := range []int{1, 2, 6} {
b.Run(fmt.Sprintf("%dx%d", n, c), func(b *testing.B) {
for i := 0; i < b.N; i++ {
Repeat(s[:n], c)
}
})
}
}
}


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 16006:

Patch Set 20:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 22: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 23: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 23:

You need to fix the commit message on GitHub since you started on GitHub.

Edit the PR description. That's what makes the commit message here.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 12446:

Uploaded patch set 24: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 27938:

Patch Set 24:

(1 comment)

Patch Set 23:

You need to fix the commit message on GitHub since you started on GitHub.

Edit the PR description. That's what makes the commit message here.

done.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5065:

Patch Set 24: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 24:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=0861ea44


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gerrit User 5976:

Patch Set 24: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/118855.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/118855 has been merged.

@gopherbot gopherbot closed this Aug 22, 2018
gopherbot pushed a commit that referenced this pull request Aug 22, 2018
name           old time/op    new time/op    delta
Repeat/5x1-4     95.9ns ± 2%    70.1ns ± 2%  -26.93%  (p=0.000 n=9+10)
Repeat/5x2-4      146ns ± 3%     100ns ± 2%  -31.99%  (p=0.000 n=10+10)
Repeat/5x6-4      203ns ± 3%     140ns ± 4%  -30.77%  (p=0.000 n=10+10)
Repeat/10x1-4     139ns ± 3%      92ns ± 4%  -34.08%  (p=0.000 n=10+10)
Repeat/10x2-4     188ns ± 4%     122ns ± 2%  -35.34%  (p=0.000 n=10+10)
Repeat/10x6-4     264ns ± 5%     179ns ± 4%  -32.15%  (p=0.000 n=10+10)

name           old alloc/op   new alloc/op   delta
Repeat/5x1-4      10.0B ± 0%      5.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Repeat/5x2-4      32.0B ± 0%     16.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Repeat/5x6-4      64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Repeat/10x1-4     32.0B ± 0%     16.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Repeat/10x2-4     64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Repeat/10x6-4      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)

Change-Id: I6619336da636df39c560f6cc481519f48c6e8176
GitHub-Last-Rev: 4b2c73f
GitHub-Pull-Request: #25894
Reviewed-on: https://go-review.googlesource.com/118855
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants