[SERVER-83633] Collapse size counting loop in WiredTigerRecordStore::_insertRecords Created: 28/Nov/23  Updated: 11/Dec/23  Resolved: 11/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Matt Kneiser Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: storex-shortlist
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-12-25
Participants:

 Description   

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.


 Comments   
Comment by Githook User [ 11/Dec/23 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-83633 Collapse size counting loop in WiredTigerRecordStore::_insertRecords

GitOrigin-RevId: a4670c62f4e7fe7d0ee9d1436c6276bab1da2878
Branch: master
https://github.com/mongodb/mongo/commit/b7a92e4194cca52665e01d81dd7f9b037b59b362

Generated at Thu Feb 08 06:52:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.