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

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 17 15:59:44 PDT 2022


jingham added a comment.

In D131996#3728253 <https://reviews.llvm.org/D131996#3728253>, @labath wrote:

> 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).

I don't remember who made the guess at 16, or what went into that choice.

What we know is that there will ALWAYS be one, and there are a lot of scalar variables floating around in code so that would cover them.  The SmallPtrSet rounds the pre-allocation up to the nearest power of 2 however.   But that's actually okay since, if the root ValueObject is a pointer, we generally also figure out the dynamic pointer value, which exists a good % of the time in C++, Swift & ObjC code.  So that means right off the bat you get two managed ValueObjects for a lot of pointers.

More that that, you'd need to know what is the center of the lowest hump in the graph of "sizes of structs in all C/C++/ObjC code"...  My feeling is that you generally end up with a bunch of small utility structs with a couple of elements (points and pairs are common), then after that the sizes expand rapidly - especially since the ClusterManager manages all the children/children of children, etc.  So 16 seems high to me.  Let's go with 4 which will give us scalars & pointers and 2/3 element structs with no allocation.  After that I don't know enough to guess a better answer.


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