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

Collapse size counting loop in WiredTigerRecordStore::_insertRecords

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Execution Team 2023-12-25

      This separate loop (code link) over the data is not needed, it can be done inline with another one of the many loops in this code path to improve cache locality and avoid needlessly thrashing the cache on large multi-inserts.

       

       

      int64_t totalLength = 0;
      for (size_t i = 0; i < nRecords; i++)
          totalLength += records[i].data.size(); 

       

       

      Two options:

      • Keep the interface the same, and compute the totalLength in both of the other loops (one for capped collections, one for regular). Pro: keeps responsibility of this function the same AND each record's size is already used in both of the other loops.
      • Compute this at a higher layer in one of the other loops and pass into this function.

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            matt.kneiser@mongodb.com Matt Kneiser
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: