[llvm] [DomTree] Reduce number of hash table lookups (NFC) (PR #73097)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 24 21:04:32 PST 2023
dwblaikie wrote:
> I see @dwblaikie's point about demonstrating that this actually helps with cache lookups, but I think this hits the point of diminishing returns fairly quickly.
I think if the data structure already had unit test infrastructure/coverage, it might be a more reasonable request (& that's part of the problem - the threshold to add that sort of infrastructure now is high (rather than when the data structure was added) & so any individual improvement/change usually doesn't motivate the work, unfortunately)
> In the past I tried to do something similar and count the number of DFS nodes visited as a proxy for overall performance. I quickly run into the problems with llvm's statistic class because it's difficult to properly anchor it in highly-generic code like this, and ended up hacking it locally and never upstreaming this counters.
Oh, yeah, I don't think I'd use the statistics stuff for this - I was thinking of a custom mock DomTree type, which could have a custom NodePtr type with a custom hasher that counts the number of times the type is hashed. A small unit test could use such a mock to count and check the number of hashes. (probably a bit brittle, but if the interface usage is small enough, it might be a sufficiently stable number to have OK signal/noise)
(no changes required from me - just idle thoughts in case someone feels sufficiently compelled to add some extra testing in here along these lines)
https://github.com/llvm/llvm-project/pull/73097
More information about the llvm-commits
mailing list