-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Major - P3
-
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.