As a followup to D99362 cache the checks that attributes belong to the same context. Looking for presence in a FoldingSet is slow.
I triggered a run in the compile-time tracker for this patch:
Looks like an improvement, but I'm not how link time is exposed in that interface... or maybe it isn't? @nikic, you mentioned there was a 1% regression in link time: can you confirm if this fixes it?
Note I also triggered a run where attributes themselves are also cached:
Seems more noisy.
Ah, I found it; the "per-file details" checkbox says it's .29% faster:
tramp3d-v4 213713M 213394M (-0.15%) CMakeFiles/tramp3d-v4.dir/tramp3d-v4.cpp.o 100598M 100613M (+0.01%) tramp3d-v4.link 113114M 112781M (-0.29%)
for LegacyPM-ReleaseLTO-g, with my follow-up that adds attribute caching totally in the noise:
tramp3d-v4 213394M 213318M (-0.04%) CMakeFiles/tramp3d-v4.dir/tramp3d-v4.cpp.o 100613M 100575M (-0.04%) tramp3d-v4.link 112781M 112744M (-0.03%)
This patch LGTM (certainly an improvement), but maybe this isn't quite enough. @nikic, thoughts?