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

improve inefficient GenericArgument predicates

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.3.1
    • 4.3 Desired
    • Internal Code
    • None
    • Fully Compatible
    • Dev Tools 2019-07-15

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: