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

Investigate using absl::flat_hash_set/map over stdx::unordered_set/map in hot paths

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Query Execution
    • QE 2024-04-15, QE 2024-04-29, QE 2024-05-13

      stdx::unordered_map redirects to absl::node_hash_map which provides pointer stability but involves more heap allocations and indirection than absl::flat_hash_map. We should consider creating a mongo::flat_map defined as absl::flat_hash_map and replace some existing uses of stdx::unordered_map with mongo::flat_map when the context doesn't require pointer stability (most uses satisfy this criteria). Let's only look into this for hot paths, since it's risky and not time efficient to investigate every node hash map that won't get us any measurable performance gains.

      We should also look into stdx::unordered_set uses as well, which is defined as absl::node_hash_set.

      Note that we don't want to change the definition of stdx::unordered_map to use absl::flat_hash_map because flat_map doesn't provide the same guarantees. This would break code. See https://abseil.io/docs/cpp/guides/container for more details on the absl maps.

            Assignee:
            evan.bergeron@mongodb.com Evan Bergeron
            Reporter:
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: