query: mapQueryList avoid resizing new slice
This is a micro-optimization, but is a common call in Map. We know the final
size of neg, so we can just allocate that size.
Change-Id: I88ddc86889229557c218e33a86dce477e7b3fbed
diff --git a/query/query.go b/query/query.go
index dfce480..31741a0 100644
--- a/query/query.go
+++ b/query/query.go
@@ -260,9 +260,9 @@
}
func mapQueryList(qs []Q, f func(Q) Q) []Q {
- var neg []Q
- for _, sub := range qs {
- neg = append(neg, Map(sub, f))
+ neg := make([]Q, len(qs))
+ for i, sub := range qs {
+ neg[i] = Map(sub, f)
}
return neg
}