Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-76917

Avoid redundant bounds check in field_ref

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • v7.0
    • 105

      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%.

            Assignee:
            colin.stolley@mongodb.com Colin Stolley
            Reporter:
            colin.stolley@mongodb.com Colin Stolley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: