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

Issue 9459044: code review 9459044: bufio: reuse Writer buffers after Flush (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 11 months ago by bradfitz
Modified:
10 years, 11 months ago
Reviewers:
iant
CC:
gri, iant, gobot, golang-dev, voidlogic
Visibility:
Public.

Description

bufio: reuse Writer buffers after Flush A bufio.Writer.Flush marks the usual end of a Writer's life. Recycle its internal buffer on those explicit flushes, but not on normal, as-needed internal flushes. benchmark old ns/op new ns/op delta BenchmarkWriterEmpty 1959 727 -62.89% benchmark old allocs new allocs delta BenchmarkWriterEmpty 2 1 -50.00% benchmark old bytes new bytes delta BenchmarkWriterEmpty 4215 83 -98.03%

Patch Set 1 #

Patch Set 2 : diff -r 75602c1fb7cc https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 75602c1fb7cc https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 78e5ea623996 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+89 lines, -17 lines) Patch
M src/pkg/bufio/bufio.go View 1 14 chunks +61 lines, -17 lines 0 comments Download
M src/pkg/bufio/bufio_test.go View 1 2 3 1 chunk +28 lines, -0 lines 0 comments Download

Messages

Total messages: 6
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 11 months ago (2013-05-21 00:01:19 UTC) #1
voidlogic
"A bufio.Writer.Flush marks the usual end of a Writer's life. " This is also often ...
10 years, 11 months ago (2013-05-21 15:22:47 UTC) #2
bradfitz
Tylor, That's true, but the additional cost (flushing to the fastest possible writer: ioutil.Discard) is ...
10 years, 11 months ago (2013-05-21 22:35:44 UTC) #3
gobot
R=gri (assigned by bradfitz)
10 years, 11 months ago (2013-05-21 22:44:06 UTC) #4
iant
LGTM
10 years, 11 months ago (2013-05-21 22:49:05 UTC) #5
bradfitz
10 years, 11 months ago (2013-05-21 22:51:55 UTC) #6
*** Submitted as https://code.google.com/p/go/source/detail?r=8e41e8e4a2ab ***

bufio: reuse Writer buffers after Flush

A bufio.Writer.Flush marks the usual end of a Writer's
life. Recycle its internal buffer on those explicit flushes,
but not on normal, as-needed internal flushes.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriterEmpty         1959          727  -62.89%

benchmark              old allocs   new allocs    delta
BenchmarkWriterEmpty            2            1  -50.00%

benchmark               old bytes    new bytes    delta
BenchmarkWriterEmpty         4215           83  -98.03%

R=gri, iant
CC=gobot, golang-dev, voidlogic7
https://codereview.appspot.com/9459044
Sign in to reply to this message.

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