[clang] [clang-tools-extra] [clang][nfc] Define ConstRecursiveASTVisitor twin of RecursiveASTVisitor (PR #160065)
Arseniy Zaostrovnykh via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 15 02:35:00 PST 2025
necto wrote:
> It doesn’t really have an impact on runtime performance in the traditional sense. When I introduced DRAV, I also tried migrating just our most commonly used visitors (the one that is called into most often I believe is `CollectUnexpandedParameterPacksVisitor`), which didn’t affect runtime performance at all. It’s only after migrating dozens of them that we incurred some performance regressions, but from what we can tell, that’s because all those large vtables are slowing down program startup a bit because of dynamic relocations—the visitor itself is just as fast irrespective of whether RAV or DRAV is used.
>
> E.g. [here](https://llvm-compile-time-tracker.com/compare.php?from=5adb5c05a2e9f31385fbba8b0436cbc07d91a44d&to=b58e589a86c06ba28d4d90613864d10be29aa5ba&stat=instructions%3Au) when I migrated a few dozen visitors from RAV to DRAV, we observed a performance regression of about 0.1%; however, compiling Clang itself got 2% faster and Clang’s binary size decreased by 5%.
Thank you for this info. I found some time to benchmark the difference, and I can confirm, in our downstream code, I did not notice any run-time performance overhead of DRAV, and each use of RAV has about 0.4s compile time penalty and adds ~250KB in the binary size. I see your point, so I'll close this PR.
https://github.com/llvm/llvm-project/pull/160065
More information about the cfe-commits
mailing list