-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
Fully Compatible
-
Execution Team 2024-02-19
-
35
We leave some perf on the table for this basic field lookup in a BSONObj. As this is fundamentally a parsing problem, we should only look at every byte once. However, we first scan the field name to determine its length (as part of constructing the BSONElement), and then we go back to compare the field name with the one we're looking for. If we start with comparing the field name, we avoid extra checks.
This results in a speedup of up to 70% on the bson_bm array lookup test case.