================
@@ -1218,42 +1268,62 @@ uint32_t SymbolContextList::AppendIfUnique(const 
SymbolContextList &sc_list,
 
 bool SymbolContextList::AppendIfUnique(const SymbolContext &sc,
                                        bool merge_symbol_into_function) {
-  collection::iterator pos, end = m_symbol_contexts.end();
-  for (pos = m_symbol_contexts.begin(); pos != end; ++pos) {
-    // Because symbol contexts might first be built without the symbol,
-    // which is then appended later on, compare the symbol contexts taking into
-    // accout that one (or either) of them might not have a symbol yet.
-    if (SymbolContext::CompareConsideringPossiblyNullSymbol(*pos, sc))
+
+  // Look in the set if it's populated, otherwise, fall back to linear scan.
+  if (!m_lookup_set.empty()) {
+    if (m_lookup_set.count(sc))
+      return false;
+  } else if (m_symbol_contexts.size() < kSetThreshold) {
----------------
adrian-prantl wrote:

> Are you doing this threshold switch because you postulate that for a small 
> number of elements the linear search is more efficient? 

That sounds like a reimplementation of SmallDenseMap?

https://github.com/llvm/llvm-project/pull/181952
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to