[RFC] Improve Dwarf 5 .debug_names Type Lookup/Parsing Speed

I’m trying to synthesize a more complete response here, sorry it’s taking some time.

(the really short/inarticulate summary is this:

  • DW_IDX_parent will add index size, which is concerning (as the index is an especially important size concern for us - it’s one of the few bits of debug info that remain in the .o/executable when using split DWARF), but maybe it’s fine - data would be good.
  • Using the absence of DW_IDX_parent to conclude that the type has no decl context (it’s in the global namespace) seems problematic, since it wouldn’t distinguish between when a producer just wasn’t producing parent at all, and when it was but the entity had no parent - perhaps we can use the CU as the parent for global namespaced entities to disambiguate this case
  • I still wonder whether there’s another approach that might help size rather than hurt it: It seems really inefficient to look up every instance of iterator for instance when looking for std::vector<int>::iterator - what if each name was looked up, and the one with the least results was used and searched within? I guess that doesn’t work for namespaces foo::bar you can’t be sure you’ll find bar in any arbitrary foo. But it does work for anything with template parameters, because those are closed… well, almost. It doesn’t work for template members of templates - foo<int>::bar<int> the bar<int> might only be in some foo<int>… (but, it still feels bad to incur all this cost for the iterator case - and other cases where the members are constrained and do appear in every instance of the outer entity) - I had this concern jus tabout the debug_names size in general, if we could avoid having to put an entry for every class member in the debug_names… :confused: )