-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Storage Execution
-
ALL
-
Execution Team 2024-11-25
This is an antipattern because it makes us go through the BSON object twice:
if (obj.hasElement(elemName)) { elem = obj["elemName"] doStuff(elem); }
Instead it should be:
elem = obj["elemName"] if (!elem.eoo()) { doStuff(elem); }
We do this in several places in our codebase, such as here, here, here, etc.
While some of the examples I listed are not on the hot path, it would help if we got rid of this idiom altogether so that it stops spreading.
See comments for more info.
- is related to
-
SERVER-88086 ApplyOps::extractOperations is too slow
- Closed
-
SERVER-88312 Improve performance of tenantID/Namespace parsing for oplog entries
- Closed