Speed up absl container gdb pretty printers

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Query Optimization
    • QO 2025-02-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-110677, we fixed the gdb symbol lookup for absl containers using a regex. This makes the first lookup very slow.

      This PR introduces a more targeted fix which speeds up the `info type` lookup by removing the `absl.*::container_internal::internal_compressed_tuple::Storage<absl.::container_internal::CommonFields, 0.*, false>` regex approach.

      Instead, we introduce the `_absl_namespace_prefix`helper which extracts the concrete versioned absl inline namespace (e.g. `absl::lts_20250512::`or `absl::`) from the container's type name. Then we introduce `_lookup_absl_common_fields_storage_type`which directly attempts `gdb.lookup_type`on the two known candidate spellings of the 0 `size_t` template parameter (`0` and `0ul`).

      Locally in gdb, I observe that printing a `CanonicalQuery`which internally contains many `absl::unordered_map`goes from over a minute to near instant.

            Assignee:
            Ben Shteinfeld
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: