-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Fully Compatible
-
ALL
-
Execution Team 2022-02-07
-
129
SERVER-27209 introduced a large change taking BSONElement::valuestr() private as a means of deprecating its use outside of BSONElement.
Background
Since compareElementStringValues() is a bare function (i.e. external to BSONElement), I looked to simplify the logic when removing its use of the privatized valuestr(). That refactor introduced a low-level difference between how to compute the int return value of StringData::compare() vs. compareElementStringValues(). Basically boiling down to forcing one-ness in the return value of a string compare. This led to a ~10% perf regression in a sensitive test for a customer noted here: HELP-23789
Solution
I pasted the logic of BSONElement::valuestr() into compareElementStringValues(). While this may take a hit on readability, it achieves a simple replacement with no meaningful perf impact.