This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Don't create entries in isecPriorities during sorting (NFC)
ClosedPublic

Authored by BertalanD on Sep 28 2022, 7:37 AM.

Details

Summary

If a value for a given key is not present, DenseMap::operator[]
default-constructs one, which is wasteful when we don't do anything with
it. Fix it by calling lookup() instead which only returns the default
value, but does not modify the map.

This speeds up linking a fair bit when only a small portion of all
sections are specified in the order file, like in the case of Chromium
Framework:

    N           Min           Max        Median           Avg        Stddev
x  25      3.727684     3.8808699      3.753552     3.7702461     0.0397282
+  25     3.6469049     3.7523289     3.6764321     3.6841622   0.025525047
Difference at 95.0% confidence
	-0.0860839 +/- 0.0189924
	-2.28324% +/- 0.503745%
	(Student's t, pooled s = 0.0333906)

Diff Detail

Event Timeline

BertalanD created this revision.Sep 28 2022, 7:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 28 2022, 7:37 AM
BertalanD requested review of this revision.Sep 28 2022, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 7:37 AM
thakis accepted this revision.Sep 28 2022, 7:39 AM
thakis added a subscriber: thakis.

Nice!

This revision is now accepted and ready to land.Sep 28 2022, 7:39 AM