Rather than looking up each referenced GUID in the index for each
value we consider importing, in order to see if it is not exportable
(e.g. needs renaming but can't be renamed), pre-compute the set of GUIDs
that can't be exported and consult that.
For a large application with aggressive importing thresholds, the index
lookup findGlobalValueSummaryList in canBeExternallyReferenced was
at the top of the profile. This change reduced the thin link time by
19% on average (the improvement was <1% on average with default
importing thresholds). For my large app, with default thresholds, there
were previously 6.1M index lookups in canBeExternallyReferenced, but with
aggressive importing thresholds there were 195M checks. The index
has 2.8M entries, while the pre-computed DoNotExport set has 13K entries.
There was no significant memory increase from the extra set.
What about replacing all of this logic by a bit in the summary that would be set during the compile phase?