Pre-allocate where and wherein arrays.
This commit is contained in:
parent
d5132a9eae
commit
f3cc365d24
@ -118,17 +118,23 @@ func (s *Server) newScanWriter(
|
|||||||
// This fills index value in wheres/whereins
|
// This fills index value in wheres/whereins
|
||||||
// so we don't have to map string field names for each tested object
|
// so we don't have to map string field names for each tested object
|
||||||
var ok bool
|
var ok bool
|
||||||
|
if len(wheres) > 0 {
|
||||||
|
sw.wheres = make([]whereT, 0, len(wheres))
|
||||||
for _, where := range wheres {
|
for _, where := range wheres {
|
||||||
if where.index, ok = sw.fmap[where.field]; ok {
|
if where.index, ok = sw.fmap[where.field]; ok {
|
||||||
sw.wheres = append(sw.wheres, where)
|
sw.wheres = append(sw.wheres, where)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if len(whereins) > 0 {
|
||||||
|
sw.whereins = make([]whereinT, 0, len(whereins))
|
||||||
for _, wherein := range whereins {
|
for _, wherein := range whereins {
|
||||||
if wherein.index, ok = sw.fmap[wherein.field]; ok {
|
if wherein.index, ok = sw.fmap[wherein.field]; ok {
|
||||||
sw.whereins = append(sw.whereins, wherein)
|
sw.whereins = append(sw.whereins, wherein)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sw.fvals = make([]float64, len(sw.farr))
|
sw.fvals = make([]float64, len(sw.farr))
|
||||||
return sw, nil
|
return sw, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user