From b28c4db3d0bc974b892bbf5029ca3841acf35217 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 31 Mar 2016 09:56:23 -0600 Subject: [PATCH] mark merge iterator as initialized This commit sets the `MergeIterator.init` flag after initialization. Previously this would generate a new heap on every call to `Next()` which caused some aggregate queries to slow by ~10,000%. --- influxql/iterator.gen.go | 4 ++++ influxql/iterator.gen.go.tmpl | 1 + 2 files changed, 5 insertions(+) diff --git a/influxql/iterator.gen.go b/influxql/iterator.gen.go index 05c218ee78..1073836c6c 100644 --- a/influxql/iterator.gen.go +++ b/influxql/iterator.gen.go @@ -182,6 +182,7 @@ func (itr *floatMergeIterator) Next() *FloatPoint { itr.heap.items = append(itr.heap.items, item) } heap.Init(itr.heap) + itr.init = true } for { @@ -1994,6 +1995,7 @@ func (itr *integerMergeIterator) Next() *IntegerPoint { itr.heap.items = append(itr.heap.items, item) } heap.Init(itr.heap) + itr.init = true } for { @@ -3803,6 +3805,7 @@ func (itr *stringMergeIterator) Next() *StringPoint { itr.heap.items = append(itr.heap.items, item) } heap.Init(itr.heap) + itr.init = true } for { @@ -5612,6 +5615,7 @@ func (itr *booleanMergeIterator) Next() *BooleanPoint { itr.heap.items = append(itr.heap.items, item) } heap.Init(itr.heap) + itr.init = true } for { diff --git a/influxql/iterator.gen.go.tmpl b/influxql/iterator.gen.go.tmpl index 8d6da0120b..5f78704efa 100644 --- a/influxql/iterator.gen.go.tmpl +++ b/influxql/iterator.gen.go.tmpl @@ -179,6 +179,7 @@ func (itr *{{$k.name}}MergeIterator) Next() *{{$k.Name}}Point { itr.heap.items = append(itr.heap.items, item) } heap.Init(itr.heap) + itr.init = true } for {