[SERVER-76917] Avoid redundant bounds check in field_ref Created: 08/May/23 Updated: 29/Oct/23 Resolved: 15/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0, 7.0.0-rc1 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Colin Stolley | Assignee: | Colin Stolley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Backport Requested: |
v7.0
|
||||||||
| Participants: | |||||||||
| Linked BF Score: | 105 | ||||||||
| Description |
|
FieldRef::getPart() gets called a lot; even moreso due to commit 851cfd2d . I observed that in https://github.com/10gen/mongo/blob/1c5aac135c035b7a7278a2dc49b44aa371e1cd1b/src/mongo/db/field_ref.cpp#L194-L197 we check the bounds on _parts, but _parts is a boost::container::small_vector which already does a bounds check in operator[](): https://github.com/10gen/mongo/blob/4973ef272c16f83e855c0d8ab5c9c2dc0d47d39f/src/third_party/boost/boost/container/vector.hpp#L1654 So we can remove that invariant check and save ~5%. |
| Comments |
| Comment by Githook User [ 12/May/23 ] |
|
Author: {'name': 'Colin Stolley', 'email': 'ccstolley@github.com', 'username': 'ccstolley'}Message: |
| Comment by Githook User [ 08/May/23 ] |
|
Author: {'name': 'Colin Stolley', 'email': 'ccstolley@github.com', 'username': 'ccstolley'}Message: |