Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Issue 1409613002: Use the sort.Search api correctly. (Closed)

Created:
5 years, 2 months ago by iannucci
Modified:
5 years, 2 months ago
CC:
chromium-reviews, infra-reviews+luci-gae_chromium.org
Base URL:
https://github.com/luci/gae.git@master
Target Ref:
refs/heads/master
Project:
luci-gae
Visibility:
Public.

Description

Use the sort.Search api correctly. I was using it again and I realized that I used it wrong here :(. Includes regression test. R=dnj@chromium.org, estaab@chromium.org, maruel@chromium.org, tandrii@chromium.org, vadimsh@chromium.org BUG= Committed: https://github.com/luci/gae/commit/43f0ab3a4229c46c418273d0334ade6b46f45a38

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -4 lines) Patch
M service/datastore/query.go View 1 chunk +6 lines, -4 lines 1 comment Download
M service/datastore/query_test.go View 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (1 generated)
iannucci
5 years, 2 months ago (2015-10-15 01:37:02 UTC) #1
Vadim Sh.
lgtm
5 years, 2 months ago (2015-10-15 02:16:03 UTC) #2
dnj
lgtm w/ thought. https://chromiumcodereview.appspot.com/1409613002/diff/1/service/datastore/query.go File service/datastore/query.go (right): https://chromiumcodereview.appspot.com/1409613002/diff/1/service/datastore/query.go#newcode278 service/datastore/query.go:278: copy(s[idx+1:], s[idx:]) nit: WDYT about making ...
5 years, 2 months ago (2015-10-15 02:23:46 UTC) #3
iannucci
On 2015/10/15 at 02:23:46, dnj wrote: > lgtm w/ thought. > > https://chromiumcodereview.appspot.com/1409613002/diff/1/service/datastore/query.go > File ...
5 years, 2 months ago (2015-10-15 05:18:08 UTC) #4
dnj
On 2015/10/15 05:18:08, iannucci wrote: > On 2015/10/15 at 02:23:46, dnj wrote: > > lgtm ...
5 years, 2 months ago (2015-10-15 08:18:54 UTC) #5
iannucci
On 2015/10/15 at 08:18:54, dnj wrote: > On 2015/10/15 05:18:08, iannucci wrote: > > On ...
5 years, 2 months ago (2015-10-15 20:37:34 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1409613002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1409613002/1
5 years, 2 months ago (2015-10-15 20:41:09 UTC) #8
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://github.com/luci/gae/commit/43f0ab3a4229c46c418273d0334ade6b46f45a38
5 years, 2 months ago (2015-10-15 20:42:46 UTC) #9
M-A Ruel
On 2015/10/15 20:37:34, iannucci wrote: > On 2015/10/15 at 08:18:54, dnj wrote: > > On ...
5 years, 2 months ago (2015-10-15 20:47:07 UTC) #10
iannucci1
On 2015/10/15 20:47:07, M-A Ruel wrote: > On 2015/10/15 20:37:34, iannucci wrote: > > On ...
5 years, 2 months ago (2015-10-15 21:00:04 UTC) #11
M-A Ruel
On 2015/10/15 21:00:04, iannucci1 wrote: > On 2015/10/15 20:47:07, M-A Ruel wrote: > > I ...
5 years, 2 months ago (2015-10-15 21:04:58 UTC) #12
Vadim Sh.
On 2015/10/15 21:00:04, iannucci1 wrote: > On 2015/10/15 20:47:07, M-A Ruel wrote: > > On ...
5 years, 2 months ago (2015-10-15 21:05:03 UTC) #13
iannucci
5 years, 2 months ago (2015-10-15 21:13:19 UTC) #14
Message was sent while issue was closed.
On 2015/10/15 at 21:05:03, vadimsh wrote:
> On 2015/10/15 21:00:04, iannucci1 wrote:
> > On 2015/10/15 20:47:07, M-A Ruel wrote:
> > > On 2015/10/15 20:37:34, iannucci wrote:
> > > > On 2015/10/15 at 08:18:54, dnj wrote:
> > > > > On 2015/10/15 05:18:08, iannucci wrote:
> > > > > > On 2015/10/15 at 02:23:46, dnj wrote:
> > > > > > > lgtm w/ thought.
> > > > > > > 
> > > > > > >
> > > > > >
> > > >
> > >
> >
https://chromiumcodereview.appspot.com/1409613002/diff/1/service/datastore/qu...
> > > > > > > File service/datastore/query.go (right):
> > > > > > > 
> > > > > > >
> > > > > >
> > > >
> > >
> >
https://chromiumcodereview.appspot.com/1409613002/diff/1/service/datastore/qu...
> > > > > > > service/datastore/query.go:278: copy(s[idx+1:], s[idx:])
> > > > > > > nit: WDYT about making eqfilts a binheap?
> > > > > > 
> > > > > > Is there a stdlib package for binheap that I'm not seeing?
> > > > > 
> > > > > Spluh! https://golang.org/pkg/container/heap/
> > > > 
> > > > Hm. Heap doesn't do deduplication, and because it's a heap, you can't
use
> > > > sort.Search to determine if the heap contains a certain value. I'll keep
it
> > in
> > > > mind for later, but I don't think that it's the right choice here.
> > > 
> > > I think Uniq() from https://github.com/xtgo/set implements Uniq() is the
> > better
> > > choice.
> > 
> > Wow, that's an ugly interface... Are the pivot arguments really necessary? I
> > mean... sort.Search is a super ugly, but I think this one takes the cake...
> > 
> > /me just wants std::set<T> :(
> 
> What are you discussing? How to optimize a search in an array of size of
<=5?.. (Unless I misunderstand something, the array in question holds filters in
the query. In any realistic situation it isn't going to be large). Stupidest
array is fastest in such situation.

Yes, there's no performance critical code here :)

If we keep on talking about it, I'll replace it with a linear search + full copy
:P

Powered by Google App Engine
This is Rietveld 408576698