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

improve inefficient GenericArgument predicates

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: 4.3 Desired
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • Dev Tools 2019-07-15

      src/mongo/db/command_generic_argument.cpp defines:

      bool isGenericArgument(StringData arg);
      bool isRequestStripArgument(StringData arg);
      bool isReplyStripArgument(StringData arg); 
      

      These are implemented by a table lookup via linear search on a std::array of struct, and then returning the value of a bool member of the struct. Two improvements:

      1) Switch from linear search to binary search.

      2) Each predicate should not have to search through structs that contain a false. That is, search a smaller pre-filtered array such that successful find automatically means the predicate is true.

       

      These predicates are called on every field of every request and response, so their speed feels important.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: