Refactor Scan stage to improve performance

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Refactor ScanStage stage to improve performance.

      Suggested changes:

      • Split ScanStage into SeekStage, ScanStage and RandomScanStage. Those operations are mutually exclusive. Splitting the stages will reduce the method sizes and reduce the amount branching on the hotpath.
      • Remove unnecessary virtual calls from IndexScan stage. If code sharing between Scan stage variants is desired a templates can be used for methods that would need to otherwise call virtual methods.
      • Refactor code and branching so that open and getNext have minimal size. All expensive/optional operatations can be extracted to separate methods to discourage inlining of code that is often skipped.
      • Encourage inlining of small methods on the hot path.
      • Reduce frequency of calling into YieldPolicy, at minimum we should be able to gate the yield checks behind the counter even if yield policy is present.

       A POC here https://github.com/10gen/mongo/compare/anna.wawrzyniak/SERVER-85623?expand=1 demonstrates the above changes and possible performance improvement (see SERVER-85623)

              Assignee:
              [DO NOT USE] Backlog - Query Execution
              Reporter:
              Anna Wawrzyniak
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: