================
@@ -188,10 +205,49 @@ class DeserializedDeclsSourceRangePrinter : public 
ASTConsumer,
 
 private:
   std::vector<const Decl *> PendingDecls;
+  llvm::DenseSet<const NamespaceDecl *> ProcessedNamespaces;
----------------
ilya-biryukov wrote:

There is a misunderstanding. The documentation says:
> DenseSet is a simple **quadratically probed** hash table.

So it would only be quadratic if the hash function is bad (which is not the 
case for pointers), otherwise it's amortized `O(1)` like one would expect.

The documentation does seem to suggest that `SmallPtrSet` is a better 
alternative, so I have switched to it. I am using the size `0`, though, because 
I anticipate that the number of namespaces we put is going to be quite large on 
average and the small-set optimization is not going to be useful.

`std::set` would be my last choice as it definitely underperforms compared to 
both alternatives, the hash tables are just so much faster in those cases in 
practice.

https://github.com/llvm/llvm-project/pull/151534
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to