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
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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

      • Check the relevant benchmarks before & after the change
        • aggregateAMillionDocumentsAndToArray
        • findManyAndToArray

      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:
              None
              None
              None
              None