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

Reserve vector size ahead of time when using DocumentSequences in generated IDL Parser

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • None
    • None
    • Service Arch
    • Fully Compatible
    • Service Arch 2024-01-08

    Description

      When using DocumentSequences, we already know the size of the array to be deserialized ahead of time. This is because the DocumentSequence is stored as a std::vector within OpMsg. This is different from when the array is within the BSON body, in which case there is no way to know the size of the array without actually iterating through it.

      The IDL parser generator can be changed here to include a values.reserve(sequence.objs.size()) call, so that when we are using DocumentSequences we don't have to perform vector reallocations due to not reserving the correct size ahead of time.

      There may be additional scope for improvement here. Please investigate that as well

      In bulkWrite perf investigations, this made a 10% difference.

      Attachments

        Activity

          People

            billy.donahue@mongodb.com Billy Donahue
            vishnu.kaushik@mongodb.com Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: