[clang] [llvm] [ImmutableSet] Optimize add/remove operations to avoid redundant tree modifications (PR #159845)
Arseniy Zaostrovnykh via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 08:57:47 PST 2025
necto wrote:
> Thank you for the heads up, @Xazax-hun, I will run some benchmarking. I guess I don't need to block the PR on this. If I discover a regression, I'll raise a follow up issue.
And after almost 3 months, I have benchmarked this patch on our analyzer test set (based on Clang Static Analyzer). Analyzing some over 200 open-source projects, I collected path-sensitive-analysis times for all entry points individually accumulating over 1M entry points. To compensate for the jitter in our CI, I ran analysis several times:
- twice for the baseline
- once for the baseline + your patch, then rerun 20 projects with seemingly most-slowed-down entry-points. this introduces some bias towards speed-ups, so I souldn't take this benchmark at face value.
To compensate for CI noise, I then selected the minimal (by absolute value) diff between baseline and patched runs, and made two histograms, for relative change in analysis time (for entry points that take > 200ms), and absolute time (in ms). Note the log scale of the y-axis (frequency).
<img width="1505" height="845" alt="relative_differences_200ms" src="https://github.com/user-attachments/assets/03608a83-4e96-4b7e-b149-22cfefd70e1b" />
<img width="1505" height="845" alt="absolute_differences" src="https://github.com/user-attachments/assets/e05584dd-0e2b-4d32-9fdd-6f211583ec0d" />
My conclusion that the performance effect is negligible, and might be a slight improvement, but that isn't certain because of how I rerun certain projects.
https://github.com/llvm/llvm-project/pull/159845
More information about the llvm-commits
mailing list