Skip to content

RAR performance improvements on Core#2192

Merged
rainersigwald merged 5 commits intodotnet:vs15.3from
rainersigwald:rar/combine-assemblyinfo-reads
Jun 9, 2017
Merged

RAR performance improvements on Core#2192
rainersigwald merged 5 commits intodotnet:vs15.3from
rainersigwald:rar/combine-assemblyinfo-reads

Conversation

@rainersigwald
Copy link
Copy Markdown
Member

I recommend going through this commit-by-commit; a couple of commits are straightforward refactors that look complicated in the final diff.

There are two improvements here:

  • When using the non-Full Framework AssemblyInformation extraction, read a file only once, populating Dependencies and FrameworkName with a single FileStream
  • Read AssemblyInformation from a given path exactly once (instead of twice).

This chips away at #2015.

* Use null propagation to reduce nesting
* Avoid a redundant comparison in an or clause
* Ensure that the produced dependencies list is big enough to hold the
  input dependentAssemblies without reallocating.
Avoid creating and disposing a FileStream in both FrameworkName and
Dependencies (usually called together) by populating both fields when
either is requested and no-oping the second read.

I tested doing this in both orders and this seemed to be consistently
faster.
@rainersigwald rainersigwald force-pushed the rar/combine-assemblyinfo-reads branch 2 times, most recently from 80dcbc4 to c9a846f Compare June 9, 2017 16:15
Comment thread src/Shared/Traits.cs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put RAR in the names of the escape hatches.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thought.

@rainersigwald rainersigwald force-pushed the rar/combine-assemblyinfo-reads branch from c9a846f to fe24685 Compare June 9, 2017 16:42
Comment thread src/Shared/Traits.cs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be different instead of equals? Cache when ("Do not cache" is not 1)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@rainersigwald rainersigwald force-pushed the rar/combine-assemblyinfo-reads branch from fe24685 to c713f47 Compare June 9, 2017 16:43
RAR read assembly metadata twice for each resolved assembly, because
referenceTable.ComputeClosure is called twice from RAR. Instead of doing
I/O both times, cache the AssemblyInformation objects for each path for
the duration of the RAR task, ensuring that each assembly is read only
once.

This allows configuration through the environment in two ways: .NET Core
defaults to the new once-per-RAR-task reading, but can go back to the
twice-per approach when MSBUILDDONOTCACHEASSEMBLYINFORMATION=1, and full
framework continues to use the old approach but allows opting in to
caching by setting MSBUILDCACHEASSEMBLYINFORMATION=1.
@rainersigwald rainersigwald force-pushed the rar/combine-assemblyinfo-reads branch from c713f47 to 55f846e Compare June 9, 2017 16:45
This is a performance win even on Full Framework, so enable it
everywhere (with an escape hatch).
Comment thread src/Tasks/SystemState.cs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much indirection :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sure wouldn't want to construct a new ReferenceTable :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you hadn't been out yesterday afternoon I was going to send you that set of parameters and have you guess what the heck it was for :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory method for a new Big Bang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants