[Lldb-commits] [PATCH] D131996: Use a SmallPtrSet rather than a SmallVector in ClusterManager.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 17 02:01:14 PDT 2022


labath accepted this revision.
labath added a comment.

In case you have an idea of what's the "typical" number of objects in shared cluster, then we can tune the integer template parameter (in case we usually have more than 16 objects, then the inline storage is just wasting space, and we could reduce it).



================
Comment at: lldb/include/lldb/Utility/SharedCluster.h:52
   ClusterManager() : m_objects() {}
-
-  llvm::SmallVector<T *, 16> m_objects;
+  llvm::SmallPtrSet<T *, 16> m_objects;
   std::mutex m_mutex;
----------------
JDevlieghere wrote:
> I assume pointers cannot be modified once they're in the set. Can this be `const T *`? 
Did you mean pointers temselves, or the objects they point to? The pointers are automatically const (you can't modify the map copy in-place), and if someone wanted to store const objects, he could always instantiate this class with `const T` instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131996/new/

https://reviews.llvm.org/D131996



More information about the lldb-commits mailing list