Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6298

Optimize cursor toArray case to eagerly BSON decode entire batch

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Cursors, Performance
    • Not Needed

      Use Case

      As a Node.js driver user performing toArray calls on my cursors
      I want the execution time to be as quick as possible
      So that I can achieve greater performance heights with the driver

      User Impact

      • cursor.toArray should take less time.

      Dependencies

      • BSON, on-demand BSON calls.

      Unknowns

      • Can we improve performance with this change?

      Acceptance Criteria

      Implementation Requirements

      • Investigate the impact of adding an API that serializes an entire batch in one call to BSON.deserialize.
        • This should avoid many calls to OnDemandDocument.get() / CursorResponse.shift()
      • port toArray to use this on demand API

      Testing Requirements

      • Ensure benchmark coverage exists in advance of this work.
        • Add a test similar to the one described in NODE-6295. Very small documents.
        • NODE-5906 added a toArray test that replicated our cursor iteration test. Double check with the team if anyone can think of a relevant case to check.

      Documentation Requirements

      • None.

      Follow Up Requirements

      • None.

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: