Page MenuHomePhabricator

[COFF] Avoid allocating temporary vectors during ICF
ClosedPublic

Authored by rnk on Sat, May 2, 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.Sat, May 2, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptSat, May 2, 2:41 PM
hans accepted this revision.Mon, May 4, 1:25 AM

Looks great to me!

This revision is now accepted and ready to land.Mon, May 4, 1:25 AM
rnk added a comment.Mon, May 4, 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.