Skip to content

Return of RAR metadata caching#2222

Merged
rainersigwald merged 1 commit intomasterfrom
features/rar-cache-assemblyinfo
Aug 4, 2017
Merged

Return of RAR metadata caching#2222
rainersigwald merged 1 commit intomasterfrom
features/rar-cache-assemblyinfo

Conversation

@rainersigwald
Copy link
Copy Markdown
Member

My previous attempt at this in #2192 had a bad side effect: it kept handles within AssemblyInformation objects live in the cache past the point of RAR returning, because nothing disposed them. They should have been cleaned up eventually, if finalizers ran after GC, but that wasn't sufficient to keep an internal test that did a rebuild in VS working--it failed copying from obj to bin because a the file in bin was held in use.

This is a cleaner approach: wrap the extraction process as it was done before, and cache an object consisting only of the results.

That "object consisting only of the results" seems like it should just be AssemblyInformation instead of a new type. I introduced the new type to minimize churn and maximize understandability of this change in the short term.

Relates to #2015.

@rainersigwald rainersigwald added this to the MSBuild 15.3 milestone Jun 15, 2017
@rainersigwald rainersigwald changed the base branch from master to vs15.3 June 15, 2017 16:03
Copy link
Copy Markdown
Contributor

@cdmihai cdmihai Jun 15, 2017

Choose a reason for hiding this comment

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

I'd name it assemblyMetadataCache. Though if it's going to get rewritten anyway, maybe not important :)

@cdmihai
Copy link
Copy Markdown
Contributor

cdmihai commented Jun 15, 2017

    internal static FrameworkName GetTargetFrameworkAttribute(string path)

Shouldn't GetTargetFrameworkAttribute get cached as well? Included in the metadata data class.


Refers to: src/Tasks/AssemblyDependency/AssemblyInformation.cs:222 in d541b3f. [](commit_id = d541b3fde95571060de73d4ef91576029c729490, deletion_comment = False)

@rainersigwald
Copy link
Copy Markdown
Member Author

Shouldn't GetTargetFrameworkAttribute get cached as well?

Yes, but it doesn't seem to be called anywhere. So I didn't bother.

Copy link
Copy Markdown
Contributor

@jeffkl jeffkl left a comment

Choose a reason for hiding this comment

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

Open an item to circle back to the AssemblyInformation class to get rid of AssemblyMetadata.

@cdmihai
Copy link
Copy Markdown
Contributor

cdmihai commented Jun 15, 2017

    internal AssemblyInformation(string sourceFile)

Are there any other usages of the AssemblyInformation constructor? If yes, it might be worth beefing up AssemblyMetadata with the new usages.


Refers to: src/Tasks/AssemblyDependency/AssemblyInformation.cs:65 in d541b3f. [](commit_id = d541b3fde95571060de73d4ef91576029c729490, deletion_comment = False)

@rainersigwald
Copy link
Copy Markdown
Member Author

No, no other uses of the AssemblyInformation constructor, so I think this is reasonably complete.

@rainersigwald rainersigwald force-pushed the features/rar-cache-assemblyinfo branch 2 times, most recently from 9db14d7 to 20cb6af Compare June 20, 2017 16:29
@rainersigwald
Copy link
Copy Markdown
Member Author

@dotnet-bot test Ubuntu16.04 Build for CoreCLR please

Improved implementation of 55f846e: doesn't hold handles to the
assemblies after reading their metadata.

Long term, more functionality could be moved into AssemblyMetadata and
out of AssemblyInformation, and `GetAssemblyMetadata()` could be modified
to return an `AssemblyMetadata` instead of its three out parameters. But
that's a risky change to make at this point in the cycle.
@rainersigwald
Copy link
Copy Markdown
Member Author

I did some benchmarks with and without this change on top of current vs15.3 (520d1aa).

Testbed is cli 2.0.0-preview2-006497 + private MSBuilds on incremental build of a project generated with dotnet new mvc.

scenario mean stdev
no-cache 1580.35 102.2840601
with-cache 1528.2 134.2231449

That's about a 3% gain, which is nothing to sneeze at but doesn't meet the bar for 15.3 at the moment, so I'll retarget this PR to master.

@rainersigwald rainersigwald changed the base branch from vs15.3 to master June 23, 2017 19:36
@rainersigwald rainersigwald force-pushed the features/rar-cache-assemblyinfo branch from 20cb6af to 649cbbc Compare June 23, 2017 19:37
@rainersigwald rainersigwald modified the milestones: MSBuild 15 "foundation update" 2, MSBuild 15.3 Jun 23, 2017
@rainersigwald
Copy link
Copy Markdown
Member Author

@dotnet-bot test Windows_NT Build for CoreCLR please

1 similar comment
@rainersigwald
Copy link
Copy Markdown
Member Author

@dotnet-bot test Windows_NT Build for CoreCLR please

@rainersigwald
Copy link
Copy Markdown
Member Author

@dotnet-bot test this please

@rainersigwald rainersigwald merged commit 079d0c9 into master Aug 4, 2017
@rainersigwald rainersigwald deleted the features/rar-cache-assemblyinfo branch August 4, 2017 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants