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

Avoid unnecessary allocation in PlanExecutorExpress

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Execution
    • Fully Compatible
    • Execution Team 2024-04-01

      Attempting to get the record id in getRIDForPoint here calls the function WiredTigerIndexCursorBase::seek(). This function will allocate a BSONObj for the underlying key_string and return it. However, this is overkill – we don't need the key_string, we just need the record id. We end up essentially throwing away the allocation we just requested.

      In a local patch, I changed the function to call seekExact, which eschewed the allocation but performs more operations that may be unnecessary – I'm not sure how "unsafe" we can be with assumptions getting the record id here.

      Regardless, this allocation is unnecessary and should be avoided.

      This will reduce the number of allocations in the hot path.

            Assignee:
            wei.hu@mongodb.com Wei Hu
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: