[Lldb-commits] [lldb] [lldb] Speed up SymbolContextList::AppendIfUnique (PR #181952)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 18 09:29:19 PST 2026
================
@@ -483,6 +484,20 @@ class SymbolContextList {
// Member variables.
collection m_symbol_contexts; ///< The list of symbol contexts.
+private:
+ struct SymbolContextInfo {
+ static SymbolContext getEmptyKey();
+ static SymbolContext getTombstoneKey();
+ static unsigned getHashValue(const SymbolContext &sc);
+ static bool isEqual(const SymbolContext &lhs, const SymbolContext &rhs);
+ };
+
+ /// Threshold above which we switch from linear scan to hash-set lookup
+ /// for uniqueness checks.
+ static constexpr size_t kSetThreshold = 1024;
+
+ llvm::SmallDenseSet<SymbolContext, 1, SymbolContextInfo> m_lookup_set;
----------------
adrian-prantl wrote:
Is the order in `m_symbol_contexts` significant, or could we only use the hashes/sorted collection?
https://github.com/llvm/llvm-project/pull/181952
More information about the lldb-commits
mailing list