[SERVER-86119] Speed up BSONObj::getField Created: 02/Feb/24 Updated: 07/Feb/24 Resolved: 07/Feb/24 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 8.0.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Geert Bosch | Assignee: | Geert Bosch |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Storage Execution
|
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Execution Team 2024-02-19 |
| Participants: |
| Description |
|
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. |
| Comments |
| Comment by Githook User [ 07/Feb/24 ] |
|
Author: {'name': 'Geert Bosch', 'email': 'GeertBosch@users.noreply.github.com', 'username': 'GeertBosch'}Message: GitOrigin-RevId: 115aeaeeb03fbe876691172600b2db8246f22b95 |