Re: code review 6495114: bytes, strings: faster Fields (issue 6495114)

41 views
Skip to first unread message

r...@golang.org

unread,
Sep 21, 2012, 5:03:35 AM9/21/12
to r...@golang.org, brad...@golang.org, rogp...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
do you have the updated version?


http://codereview.appspot.com/6495114/diff/8001/src/pkg/bytes/bytes.go
File src/pkg/bytes/bytes.go (right):

http://codereview.appspot.com/6495114/diff/8001/src/pkg/bytes/bytes.go#newcode303
src/pkg/bytes/bytes.go:303: if c < 0x80 {
utf8.RuneSelf

http://codereview.appspot.com/6495114/diff/8001/src/pkg/bytes/bytes.go#newcode327
src/pkg/bytes/bytes.go:327: if c < 0x80 {
utf8.RuneSelf

http://codereview.appspot.com/6495114/diff/8001/src/pkg/strings/strings.go
File src/pkg/strings/strings.go (right):

http://codereview.appspot.com/6495114/diff/8001/src/pkg/strings/strings.go#newcode283
src/pkg/strings/strings.go:283: if c < 0x80 {
utf8.RuneSelf

http://codereview.appspot.com/6495114/

Russ Cox

unread,
Sep 21, 2012, 10:37:58 AM9/21/12
to r...@golang.org, r...@golang.org, brad...@golang.org, rogp...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
On Fri, Sep 21, 2012 at 5:03 AM, <r...@golang.org> wrote:
> do you have the updated version?

No, not yet. I am still thinking about what the right resizing
strategy is. I can make the code much faster on the benchmark by
estimating the new array size based on fields/byte processed so far,
cutting out almost all reallocations, but that gives it the chance to
wildly overestimate and overallocate what it would otherwise need. The
current code, while slower by being two passes, at least does not
overallocate. I'm still not quite sure how to balance those. Probably
I will give up that particular speedup and go back to ordinary append.

Russ
Reply all
Reply to author
Forward
0 new messages