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

Unified Diff: impl/memory/datastore_index.go

Issue 1312433013: Switch to external stringset implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix nitish Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | impl/memory/datastore_index_selection.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_index.go
diff --git a/impl/memory/datastore_index.go b/impl/memory/datastore_index.go
index e61ce89d770c411f89df47ca34d3aa25719bad6e..aa84af641ba6d587a14749f5688432cca435453c 100644
--- a/impl/memory/datastore_index.go
+++ b/impl/memory/datastore_index.go
@@ -12,6 +12,7 @@ import (
ds "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/datastore/serialize"
"github.com/luci/gkvlite"
+ "github.com/luci/luci-go/common/stringset"
)
type qIndexSlice []*ds.IndexDefinition
@@ -61,7 +62,7 @@ func (s serializedPvals) Less(i, j int) bool { return bytes.Compare(s[i], s[j])
type serializedIndexablePmap map[string]serializedPvals
func serializeRow(vals []ds.Property) serializedPvals {
- dups := map[string]struct{}{}
+ dups := stringset.New(0)
ret := make(serializedPvals, 0, len(vals))
for _, v := range vals {
if v.IndexSetting() == ds.NoIndex {
@@ -69,10 +70,9 @@ func serializeRow(vals []ds.Property) serializedPvals {
}
data := serialize.ToBytes(v.ForIndex())
dataS := string(data)
- if _, ok := dups[dataS]; ok {
+ if !dups.Add(dataS) {
continue
}
- dups[dataS] = struct{}{}
ret = append(ret, data)
}
return ret
« no previous file with comments | « no previous file | impl/memory/datastore_index_selection.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698