From ed41122aded4c61532e42e626f9c87fb0cf1d836 Mon Sep 17 00:00:00 2001 From: Edd Robinson Date: Thu, 15 Sep 2016 17:26:30 +0100 Subject: [PATCH] Pre-allocate map for performance --- tsdb/meta.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tsdb/meta.go b/tsdb/meta.go index a43a8aba86..57f0f8d82b 100644 --- a/tsdb/meta.go +++ b/tsdb/meta.go @@ -1088,7 +1088,11 @@ func (m *Measurement) walkWhereForSeriesIds(expr influxql.Expr) (SeriesIDs, Filt return nil, nil, err } - filters := FilterExprs{} + if len(ids) == 0 { + return ids, nil, nil + } + + filters := make(FilterExprs, len(ids)) for _, id := range ids { filters[id] = expr }