-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Currently, in PlanCacheSizeParameter::parse in src/mongo/db/query/plan_cache_size_parameter.cpp, we take an std::string reference as input and use it to match against a regular expression. We also need to do a lot of std::string conversions on the output.
However, we don't really need std::string. matchView will accept a StringData as input. Then the std::stod can be changed to exploit our knowledge of m[1]'s format.
We know it's digits, a dot, and then maybe more digits.
The parseUnitString function should just be changed to take StringData.
double size; invariant(!std::from_chars<double>( m[1].begin(), m[1].end(), size, std::chars_format::fixed).ec); auto statusWithUnit = parseUnitString(m[2]);
We will use an invariant instead of uassert because it would indicate that our compiled-in regex was wrong, in that it didn't have the right captures to produce a valid fixed point number.