This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Avoid allocating temporary vectors during ICF
ClosedPublic

Authored by rnk on May 2 2020, 2:41 PM.

Details

Summary

Heap profiling with ETW shows that LLD allocates 4,053,721 bytes of heap
memory over its lifetime, and ~800,000 of them come from assocEquals.
These vectors are created just to do a comparison, so fuse the
comparison into the loop and avoid the allocation.

ICF is overall a small portion of the time spent linking, and I did not
measure overall throughput improvements from this change above the noise
threshold. However, these show up in the heap profiler, and the work is
done, so we might as well land it if the code is clear enough.

Diff Detail

Event Timeline

rnk created this revision.May 2 2020, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2020, 2:41 PM
hans accepted this revision.May 4 2020, 1:25 AM

Looks great to me!

This revision is now accepted and ready to land.May 4 2020, 1:25 AM
rnk added a comment.May 4 2020, 7:03 AM

Heap profiling with ETW shows that LLD allocates 4,053,721 bytes of heap
memory over its lifetime, and ~800,000 of them come from assocEquals.

I misspoke here, I didn't understand the WPA heap profiler API. These numbers are for individual allocations.

I wasn't able to measure much speed improvement, but it makes LLD faster under the heap profiler. :) Fewer heap allocation stack traces for it to process.

This revision was automatically updated to reflect the committed changes.