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

Issue 51360046: code review 51360046: bufio: fix benchmarks behavior (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 3 months ago by dvyukov
Modified:
10 years, 3 months ago
Reviewers:
brainman, rsc
CC:
golang-codereviews, brainman, rsc
Visibility:
Public.

Description

bufio: fix benchmarks behavior Currently the benchmarks lie to testing package by doing O(N) work under StopTimer. And that hidden O(N) actually consitutes the bulk of benchmark work (e.g includes GC per iteration). This behavior accounts for windows-amd64-race builder hangs. Before: BenchmarkReaderCopyOptimal-4 1000000 1861 ns/op BenchmarkReaderCopyUnoptimal-4 500000 3327 ns/op BenchmarkReaderCopyNoWriteTo-4 50000 34549 ns/op BenchmarkWriterCopyOptimal-4 100000 16849 ns/op BenchmarkWriterCopyUnoptimal-4 500000 3126 ns/op BenchmarkWriterCopyNoReadFrom-4 50000 34609 ns/op ok bufio 65.273s After: BenchmarkReaderCopyOptimal-4 10000000 172 ns/op BenchmarkReaderCopyUnoptimal-4 10000000 267 ns/op BenchmarkReaderCopyNoWriteTo-4 100000 22905 ns/op BenchmarkWriterCopyOptimal-4 10000000 170 ns/op BenchmarkWriterCopyUnoptimal-4 10000000 226 ns/op BenchmarkWriterCopyNoReadFrom-4 100000 20575 ns/op ok bufio 14.074s Note the change in total time.

Patch Set 1 #

Patch Set 2 : diff -r 7abe32ccffb1 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r 7abe32ccffb1 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 4 : diff -r 7abe32ccffb1 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 2

Patch Set 5 : diff -r 7abe32ccffb1 https://dvyukov%40google.com@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+44 lines, -24 lines) Patch
M src/pkg/bufio/bufio_test.go View 1 2 3 4 1 chunk +44 lines, -24 lines 0 comments Download

Messages

Total messages: 5
dvyukov
Hello golang-codereviews@googlegroups.com (cc: alex.brainman@gmail.com), I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
10 years, 3 months ago (2014-01-23 10:08:42 UTC) #1
brainman
LGTM but I don't know enough to test it properly. Perhaps you should wait for ...
10 years, 3 months ago (2014-01-23 12:22:52 UTC) #2
dvyukov
thanks! https://codereview.appspot.com/51360046/diff/10002/src/pkg/bufio/bufio_test.go File src/pkg/bufio/bufio_test.go (right): https://codereview.appspot.com/51360046/diff/10002/src/pkg/bufio/bufio_test.go#newcode1186 src/pkg/bufio/bufio_test.go:1186: dstReader := NewWriter(dstBuf) On 2014/01/23 12:22:53, brainman wrote: ...
10 years, 3 months ago (2014-01-23 14:56:12 UTC) #3
rsc
LGTM
10 years, 3 months ago (2014-01-23 20:13:06 UTC) #4
rsc
10 years, 3 months ago (2014-01-23 20:13:25 UTC) #5
*** Submitted as https://code.google.com/p/go/source/detail?r=847f3d4e7104 ***

bufio: fix benchmarks behavior
Currently the benchmarks lie to testing package by doing O(N)
work under StopTimer. And that hidden O(N) actually consitutes
the bulk of benchmark work (e.g includes GC per iteration).
This behavior accounts for windows-amd64-race builder hangs.

Before:
BenchmarkReaderCopyOptimal-4	 1000000	      1861 ns/op
BenchmarkReaderCopyUnoptimal-4	  500000	      3327 ns/op
BenchmarkReaderCopyNoWriteTo-4	   50000	     34549 ns/op
BenchmarkWriterCopyOptimal-4	  100000	     16849 ns/op
BenchmarkWriterCopyUnoptimal-4	  500000	      3126 ns/op
BenchmarkWriterCopyNoReadFrom-4	   50000	     34609 ns/op
ok  	bufio	65.273s

After:
BenchmarkReaderCopyOptimal-4	10000000	       172 ns/op
BenchmarkReaderCopyUnoptimal-4	10000000	       267 ns/op
BenchmarkReaderCopyNoWriteTo-4	  100000	     22905 ns/op
BenchmarkWriterCopyOptimal-4	10000000	       170 ns/op
BenchmarkWriterCopyUnoptimal-4	10000000	       226 ns/op
BenchmarkWriterCopyNoReadFrom-4	  100000	     20575 ns/op
ok  	bufio	14.074s

Note the change in total time.

LGTM=alex.brainman, rsc
R=golang-codereviews, alex.brainman, rsc
CC=golang-codereviews
https://codereview.appspot.com/51360046

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

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