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%.
pull/6173/head
Ben Johnson 2016-03-31 09:56:23 -06:00
parent e7cce69530
commit b28c4db3d0
2 changed files with 5 additions and 0 deletions

View File

@ -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 {

View File

@ -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 {