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

Remove unwanted copy of hash table

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • QE 2024-05-27

      While testing a isMember call in the profiler, I spotted that SERVER-51537 changed the temp variable for a call to values() from being a reference to being a full type, leading to a deep copy of the hash table:

           } else if (arrTag == value::TypeTags::ArraySet) {
      +        // An empty ArraySet may not have a collation, but we don't need one to definitively
      +        // determine that the empty set doesn't contain the value we are checking.
               auto arrSet = value::getArraySetView(arrVal);
      -        auto& values = arrSet->values();
      -
      -        const bool found = values.find({inputTag, inputVal}) != values.end();
      -
      -        return {false, value::TypeTags::Boolean, value::bitcastFrom<bool>(found)};
      +        if (arrSet->size() == 0) {
      +            return {false, value::TypeTags::Boolean, value::bitcastFrom<bool>(false)};
      +        }
      +        auto values = arrSet->values(); 

            Assignee:
            alberto.massari@mongodb.com Alberto Massari
            Reporter:
            alberto.massari@mongodb.com Alberto Massari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: