Use a SmallPtrSet rather than a SmallVector in ClusterManager.
The m_objects store in this class is only used to check whether this ClusterManager already owns this pointer. With a SmallVector the is_contained call was non-linear in number of children, and for instance printing all the elements of a 16M element std::vector didn't complete in the time I was willing to wait for it (hours). Since we are only doing insert & contains, some kind of set is a better data structure. In this patch I used SmallPtrSet. With that, the same array prints out in 30 seconds. I also tried a std::unordered_set but that was slightly slower and used a fair bit more memory. Other than performance, this is NFC. Differential Revision: https://reviews.llvm.org/D131996
Loading
Please sign in to comment