Simplify hot path code in executors

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2025-08-04
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The PlanExecutor interface currently has the following pure virtual methods for retrieving the next single result:

          virtual ExecState getNext(BSONObj* out, RecordId* dlOut) = 0;
          virtual ExecState getNextDocument(Document* objOut, RecordId* dlOut) = 0;
      

      It turns out that getNextDocument() is never called with a non-nullptr RecordId* in any of PlanExecutor 's sub-classes, so we should remove the dlOut parameter from the getNextDocument() signature entirely.

      It also turns out that in many cases the getNext() function internally calls getNextDocument(), with the objOut* pointer being a non-nullptr. We can optimize these cases too.
      Streamlining this code will lead to less conditional branches and less temporary object creations on the executor hot path code.

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

                Created:
                Updated: