• Type: Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QE 2023-05-15
    • 30

      LockStats has a function called reset() which resets its counters to zero. These are all atomic sets, so they're not trivially cheap. LockStats unnecessarily calls reset() in both the constructor and the destructor. These are both called with every OperationContext's lifetime, so it's a pretty hot path.

      The constructor doesn't need to call reset() because it can construct the atomics with an initial value of 0 instead. Initial values are not set atomically, which makes them cheaper.

      The destructor doesn't need to call reset() because the object is in the process of being destroyed. This was probably a copy/paste mistake.

            Assignee:
            colin.stolley@mongodb.com Colin Stolley
            Reporter:
            colin.stolley@mongodb.com Colin Stolley
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: