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

Stop creating and destroying unnecessary vectors in checkAndAssertTypes

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • Repl 2023-11-13, Repl 2023-11-27

    Description

      The IDL parser generator produces code of the form var.checkAndAssertTypes("Context", {BSONType1, BSONType2, ...}) , i.e. it produces code where a BSONType[] is passed to checkAndAssertTypes(). However, since this function expects a vector, the BSONType[] is repeatedly converted to a vector and then destroyed right after the function call.

      Instead we can pass in pointers and make this a lot quicker to avoid many allocations and frees.

      In the attached screenshots, the functions highlighted in purple represent amount of time spent doing this. The more elaborate screenshot is from a debug build, and there we see that the construction & destruction of vectors take about 40% of parse time. In the opt=on build, the construction & destruction take 20% of the total time

      Attachments

        Activity

          People

            vishnu.kaushik@mongodb.com Vishnu Kaushik
            vishnu.kaushik@mongodb.com Vishnu Kaushik
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: