Optimize DocumentStorage::findField() and HashedFieldName

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Following the toolchain upgrade to v5, -O2 included a number of vector instruction optimizations which generally improve performance. However for some hot paths, performance can degrade compared to implementations using scalar instructions.
      One such regression was discovered in DocumentStorage::findField(), in which vector instructions are used for parameter passing. We can eliminate this regression with two modest optimizations:

      • HashedFieldName can be shrunk by using unsigned ints instead of size_ts
      • We can avoid passing a policy enum to each findField() call because we already have two methods for both policies: one that only searches the cache, and one that searches the cache and the BSON.

      These optimizations cause the compiler to revert to using scalar instructions, so the regression goes away.

            Assignee:
            Colin Stolley
            Reporter:
            Colin Stolley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: