[Lldb-commits] [lldb] [lldb] Speed up SymbolContextList::AppendIfUnique (PR #181952)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 20 00:00:29 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;
----------------
Michael137 wrote:
I'd be a tiny bit weary of changing the ordering guarantees of this. Especially because this is a regression fix on top of a regression fix, which we likely need to get into a release. So if we can fix the performance issue while maintaining behaviour, that'd be ideal. And anything else can be follow-up
My 2 cents
https://github.com/llvm/llvm-project/pull/181952
More information about the lldb-commits
mailing list