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

Issue 6849128: code review 6849128: bytes: avoid duplicate malloc/copy in Buffer.ReadString (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by remyoudompheng
Modified:
11 years, 3 months ago
Reviewers:
CC:
golang-dev, dfc, DMorsing, bradfitz
Visibility:
Public.

Description

bytes: avoid duplicate malloc/copy in Buffer.ReadString Twice faster and twice less garbage.

Patch Set 1 #

Patch Set 2 : diff -r 1b8c2fe167fc https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 1b8c2fe167fc https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 4 : diff -r 1b8c2fe167fc https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 5 : diff -r 230e82a3bbf4 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 230e82a3bbf4 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -8 lines) Patch
M src/pkg/bytes/buffer.go View 1 2 3 4 2 chunks +16 lines, -8 lines 0 comments Download
M src/pkg/bytes/buffer_test.go View 1 2 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 10
remyoudompheng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 4 months ago (2012-11-30 19:59:37 UTC) #1
dfc
On 2012/11/30 19:59:37, remyoudompheng wrote: > Hello mailto:golang-dev@googlegroups.com (cc: mailto:golang-dev@googlegroups.com), > > I'd like you ...
11 years, 4 months ago (2012-11-30 20:18:32 UTC) #2
DMorsing
You could pull the slicing code into a new method and have ReadBytes and ReadString ...
11 years, 4 months ago (2012-11-30 20:30:15 UTC) #3
bradfitz
https://codereview.appspot.com/6849128/diff/5001/src/pkg/bytes/buffer.go File src/pkg/bytes/buffer.go (right): https://codereview.appspot.com/6849128/diff/5001/src/pkg/bytes/buffer.go#newcode382 src/pkg/bytes/buffer.go:382: i := IndexByte(b.buf[b.off:], delim) you could also introduce a ...
11 years, 4 months ago (2012-11-30 20:35:22 UTC) #4
remyoudompheng
On 2012/11/30 20:18:32, dfc wrote: > Could you post a sample benchcmp ? benchmark old ...
11 years, 4 months ago (2012-11-30 21:02:48 UTC) #5
remyoudompheng
Hello golang-dev@googlegroups.com, dave@cheney.net, daniel.morsing@gmail.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2012-11-30 21:05:01 UTC) #6
DMorsing
LGTM
11 years, 4 months ago (2012-11-30 21:31:16 UTC) #7
bradfitz
LGTM https://codereview.appspot.com/6849128/diff/10001/src/pkg/bytes/buffer.go File src/pkg/bytes/buffer.go (right): https://codereview.appspot.com/6849128/diff/10001/src/pkg/bytes/buffer.go#newcode368 src/pkg/bytes/buffer.go:368: // readSlice is like readBytes but returns a ...
11 years, 4 months ago (2012-11-30 23:48:09 UTC) #8
dfc
LGTM. The comment below is just a suggestion, feel free to reword/ignore it. https://codereview.appspot.com/6849128/diff/10001/src/pkg/bytes/buffer.go File ...
11 years, 4 months ago (2012-12-01 00:12:27 UTC) #9
remyoudompheng
11 years, 3 months ago (2012-12-03 13:04:25 UTC) #10
*** Submitted as https://code.google.com/p/go/source/detail?r=1f3ebf9a7548 ***

bytes: avoid duplicate malloc/copy in Buffer.ReadString

Twice faster and twice less garbage.

R=golang-dev, dave, daniel.morsing, bradfitz
CC=golang-dev
https://codereview.appspot.com/6849128
Sign in to reply to this message.

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