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

Issue 4121045: code review 4121045: suffixarray: fix construction bug (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by Eric Roshan Eisner
Modified:
14 years, 1 month ago
Reviewers:
CC:
gri, gri1, golang-dev
Visibility:
Public.

Description

suffixarray: fix construction bug Previously, group numbers were updated while being read, sometimes leading to inconsistencies.

Patch Set 1 #

Patch Set 2 : code review 4121045: suffixarray: fix construction bug #

Total comments: 1

Patch Set 3 : code review 4121045: suffixarray: fix construction bug #

Patch Set 4 : code review 4121045: suffixarray: fix construction bug #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -12 lines) Patch
M src/pkg/index/suffixarray/qsufsort.go View 1 2 3 1 chunk +18 lines, -12 lines 1 comment Download
M src/pkg/index/suffixarray/suffixarray_test.go View 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 10
Eric Roshan Eisner
Hello gri (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 1 month ago (2011-01-31 15:00:58 UTC) #1
gri1
LGTM http://codereview.appspot.com/4121045/diff/4/src/pkg/index/suffixarray/qsufsort.go File src/pkg/index/suffixarray/qsufsort.go (right): http://codereview.appspot.com/4121045/diff/4/src/pkg/index/suffixarray/qsufsort.go#newcode154 src/pkg/index/suffixarray/qsufsort.go:154: defer markGroup(x.sa[first:i], x.inv, offset+i-1) cute! I don't have ...
14 years, 1 month ago (2011-01-31 19:45:44 UTC) #2
Eric Roshan Eisner
On Mon, Jan 31, 2011 at 14:45, <gri@google.com> wrote: > LGTM > > > > ...
14 years, 1 month ago (2011-01-31 19:56:13 UTC) #3
Eric Roshan Eisner
Hello gri, gri1 (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 1 month ago (2011-01-31 20:55:12 UTC) #4
Eric Roshan Eisner
Hello gri, gri1 (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 1 month ago (2011-01-31 20:55:35 UTC) #5
Eric Roshan Eisner
Here's the alternative implementation without defer. The runtimes probably aren't very different, but this one ...
14 years, 1 month ago (2011-01-31 20:57:41 UTC) #6
gri
*** Submitted as http://code.google.com/p/go/source/detail?r=28e01f39cba9 *** suffixarray: fix construction bug Previously, group numbers were updated while ...
14 years, 1 month ago (2011-01-31 21:13:05 UTC) #7
gri1
LGTM I liked the defer code, but this code looks equally straightforward and probably a ...
14 years, 1 month ago (2011-01-31 21:13:13 UTC) #8
rsc
FYI http://codereview.appspot.com/4121045/diff/9001/src/pkg/index/suffixarray/qsufsort.go File src/pkg/index/suffixarray/qsufsort.go (right): http://codereview.appspot.com/4121045/diff/9001/src/pkg/index/suffixarray/qsufsort.go#newcode149 src/pkg/index/suffixarray/qsufsort.go:149: bounds := make([]int, 0, 4) If you can't ...
14 years, 1 month ago (2011-02-01 12:52:43 UTC) #9
Eric Roshan Eisner
14 years, 1 month ago (2011-02-01 15:45:10 UTC) #10
On Tue, Feb 1, 2011 at 07:52, <rsc@golang.org> wrote:

> FYI
>
>
>
>
>
http://codereview.appspot.com/4121045/diff/9001/src/pkg/index/suffixarray/qsu...
>
> File src/pkg/index/suffixarray/qsufsort.go (right):
>
>
>
http://codereview.appspot.com/4121045/diff/9001/src/pkg/index/suffixarray/qsu...
> src/pkg/index/suffixarray/qsufsort.go:149: bounds := make([]int, 0, 4)
> If you can't measure the difference, then it doesn't matter,
> but the old code (using defer) was more efficient wrt
> memory allocation, because memory allocated to hold
> the defer stack is cleaned up immediately after use, while
> memory allocated with make or new is left for the
> garbage collector.
>
>
> http://codereview.appspot.com/4121045/
>

Indexing about 1M random data showed the following results:

-The committed code using make/append is ~25% slower than the previous
release.
-The defer-based code is ~60% slower than the previous release.

The timing probably doesn't take into account the extra garbage collection
from the make/append approach, but it still seems like a better choice to
me.
Sign in to reply to this message.

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