Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55835

BSONIteratorSorted should reuse calculated fieldName size

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Execution Team 2021-04-19

      BSONIteratorSorted traverses the provided BSONObj to collect all field names. But when storing it just uses char*.

      This leads to the comparator having to re-calculate the field name size over and over again during the sorting stage.

      Later when a user is extracting BSONElements in sorted order the field name sizes are calculated yet again.

      We should be able to just calculate it once and then reuse.

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: