Skip to content

Commit

Permalink
Skip parsing types in ILLinkTrim.Descriptors if not needed (#79803)
Browse files Browse the repository at this point in the history
We should not even be using this parser (#79802). It's surprisingly slow to use this.

This saves about 10% of wallclock time when compiling Hello World (yes, I can't believe my measurements either). We parse the descriptors for the purposes of manifest resources pretty late in the single threaded phase.
  • Loading branch information
MichalStrehovsky authored Dec 19, 2022
1 parent a23fe3a commit 0579209
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ private SubstitutionsReader(TypeSystemContext context, XmlReader reader, ModuleD
{
}

protected override bool ShouldProcessTypes => false;

public static HashSet<string> GetSubstitutions(TypeSystemContext context, XmlReader reader, ModuleDesc module, IReadOnlyDictionary<string, bool> featureSwitchValues)
{
var rdr = new SubstitutionsReader(context, reader, module, featureSwitchValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ private void ProcessAssembly(ModuleDesc assembly)
_reader.ReadEndElement();
}

protected virtual bool ShouldProcessTypes => true;

private void ProcessType(ModuleDesc assembly)
{
if (ShouldProcessElement())
if (ShouldProcessTypes && ShouldProcessElement())
{
string typeName = _reader.GetAttribute("fullname");

Expand Down

0 comments on commit 0579209

Please sign in to comment.