Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
4.3 Desired
-
None
-
Fully Compatible
-
Dev Tools 2019-07-15
Description
src/mongo/db/command_generic_argument.cpp defines:
bool isGenericArgument(StringData arg);
|
bool isRequestStripArgument(StringData arg);
|
bool isReplyStripArgument(StringData arg);
|
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.