[SERVER-42261] improve inefficient GenericArgument predicates Created: 17/Jul/19 Updated: 29/Oct/23 Resolved: 17/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 4.3 Desired |
| Fix Version/s: | 4.3.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Dev Tools 2019-07-15 |
| Participants: |
| Description |
|
src/mongo/db/command_generic_argument.cpp defines:
These are implemented by a table lookup via linear search on a std::array of struct, and then returning the value of a bool member of the struct. Two improvements: 1) Switch from linear search to binary search. 2) Each predicate should not have to search through structs that contain a false. That is, search a smaller pre-filtered array such that successful find automatically means the predicate is true.
These predicates are called on every field of every request and response, so their speed feels important. |
| Comments |
| Comment by Githook User [ 17/Jul/19 ] |
|
Author: {'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}Message: |
| Comment by Billy Donahue [ 17/Jul/19 ] |