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

Avoid unnecessary string copies in NumberParser

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • None
    • None
    • Service Arch
    • Fully Compatible
    • Service Arch 2023-10-02, Service Arch 2023-10-16

    Description

      NumberParser is used in BSONElement, the SBE VM, and many _gen files. This class uses a helper function parseNumberFromStringHelper, where I see two unnecessary string copies: #1 and #2.

      In an extreme case I came up with, parsing one million numbers from {$match: {a: 1, b: 1, c: 1, ...}} originally took 4 seconds, and with a few lines change to avoid a copy it took 2 seconds instead, and the patch was green.

      We should also look at the Decimal128 constructors, they appear to make unnecessary copies as well.

      Attachments

        Activity

          People

            patrick.freed@mongodb.com Patrick Freed
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: