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

Audit and remove use of const StringData& and add a lint rule

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible
    • SP Prioritized List

      The code base currently contains many uses of const StringData&, in particular as a function argument. StringData should almost always be passed by value; it is already a view type and is cheap to copy. Passing by value eliminates additional pointer indirections required to pass by reference, and enables the compiler to optimize the code more aggressively.

      We should remove all the usages we can of passing by reference and add a lint or static analysis rule to catch it in the future.

            Assignee:
            joseph.prince@mongodb.com Joseph Prince
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: