Reduce work in Min/MaxN / First/LastN accumulators

XMLWordPrintableJSON

    • Query Execution
    • Fully Compatible
    • v9.0
    • QE 2026-08-03
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      `AccumulatorMinMaxN::_processValue()`: ($minN/$maxN):

      • `val.getApproximateSize()` was computed unconditionally on every call, but that size is only needed when the value is actually stored. In steady state the heap is full of n elements and most incoming values are rejected by the `_valueComp.compare(...)` check. Since `getApproximateSize()` recursively walks the `Value`, this was wasted work for every rejected value.
      • On eviction, replaced `_heap.back() = {val, sz}

        ` which builds a temporary pair then move-assigns) with direct member assignment.

      `AccumulatorFirstLastN::_processValue()`: ($firstN/$lastN):

      • The `valToProcess` copy of `val` was materialized before the $firstN- already-full early return, so it was copied and immediately discarded. The copy is now made after the early-return check.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: