Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Improve sync time with a global test-runtime project.json restore upfront. - #12345

Merged
karajas merged 11 commits into
dotnet:masterfrom
karajas:testRestore
Oct 18, 2016
Merged

karajas merged 11 commits into
dotnet:masterfrom
karajas:testRestore

Conversation

@karajas

@karajas karajas commented Oct 4, 2016 •

Copy link
Copy Markdown
Member

This change is to improve the time taken by sync.cmd. It introduces the following changes.

  • Unifying all the test project.json's into a common project.json for the test build being consumed.
  • Removing test project.json's from the test dir and the test csproj, instead consuming the global one which is now in test-runtime.
  • Restoring this test-runtime project.json upfront as a part of both build and sync.

There is only one test project.json now so as to avoid download contention withing the nuget restore processes while restoring multiple project.json's (which eats up double the raw download time of the packages).

A singular project.json also removes all the I/O operations of generating multiple test lock files. (75% of the restore step is just in generating and walking through the lockfiles, IsRestoreRequired is a great way to avoid rerun cost for projects that still require their test project.json.)

/cc @weshaggard @ericstj @markwilkie

@karajas

karajas commented Oct 4, 2016

Copy link
Copy Markdown
Member Author

This is a initial version, will file issues for furthur cleanup.

@karajas karajas changed the title Improve build time with the test project.json restore upfront. Improve sync time with a global test-runtime project.json restore upfront. Oct 4, 2016
@stephentoub

Copy link
Copy Markdown
Member

Thanks, @karajas. How much does this improve the sync time?

@karajas

karajas commented Oct 5, 2016

Copy link
Copy Markdown
Member Author

On my machine, the sync step was

TotalMinutes : 12.0820112816667
TotalSeconds : 724.9206769

After using the common project.json,
TotalMinutes : 4.79851351166667
TotalSeconds : 287.9108107

@karajas

karajas commented Oct 5, 2016 •

Copy link
Copy Markdown
Member Author

Testing this with some further changes,

  • Since perf is now in a separate project.json that is exclude compiled, this now means that all the Performance projects require a separate project.json to compile until we can include compile the perf libs
  • Any library which has special compilation requirements(exclude compiles, implementations to compile, etc.) requires it's project.json to be adjacent to the test project
  • In the current implementation of the test-runtime project.json, I had to exclude compile some libraries like Microsoft.Win32.Registry and Reflection.Emit.* to avoid restore errors in the UAP10.0 framework section. So in the current run, projects that directly depend on these libraries require a project.json.

This increases the reduced restore time to TotalMinutes : 7.293574075 but I'm working on bringing this down.

edit: Current failures look like missing Test Data, will double check versions required by the project's.

@stephentoub

Copy link
Copy Markdown
Member

On my machine, the sync step was
TotalMinutes : 12.0820112816667
TotalMinutes : 4.79851351166667

Thanks. Good start on improving this. FWIW, a typical sync.cmd run for me typically takes over half an hour :-( so I very much welcome improvements here.

@markwilkie

Copy link
Copy Markdown

@stephentoub More improvements coming too.... :)

Comment thread dir.targets Outdated
</SupplementalTestData>
</ItemGroup>

<PropertyGroup>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with this being here for now but once we get this all working we should put this in test.targets in build tools. .

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.

I think we wanted to make this change specific to the repo that it was going into in case their were any properties that we wanted to be custom to it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I can agree with the ProjectJson/ProjectLockJson properties.

"coreFx.Test.net463": {}
}
}
"dependencies": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason we still need this project.json?

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.

Will fix.

<!-- TODO: Replace this with a package reference. -->
<ItemGroup>
<None Include="project.json" />
<ProjectReference Include="..\..\System.Drawing.Primitives\pkg\System.Drawing.Primitives.pkgproj" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suspect these packages already exist now.

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.

Will fix.

@weshaggard

Copy link
Copy Markdown
Member

Since perf is now in a separate project.json that is exclude compiled, this now means that all the Performance projects require a separate project.json to compile until we can include compile the perf libs

What do they have to exclude compile of? Can we fix that?

@karajas

karajas commented Oct 5, 2016 •

Copy link
Copy Markdown
Member Author

I was trying to isolate projects that depended on a separate version of NETStandard.Library. Today that would be the xunit library through the TestSuite package and the perf runner packages. Ideally I would like to isolate runners that depend on older metapackage versions as well, like the uwp runner. This is less of an issue today because we force it to pick up only the latest packages.

I'll try include compiling the perf libraries again and see if they work but I recall some pretty large restore errors.

@karajas

karajas commented Oct 6, 2016

Copy link
Copy Markdown
Member Author

Think I resolved the perf libraries to be include compiled, so am now trying a run with all the perf project.json's removed again.

@karajas
karajas force-pushed the testRestore branch 2 times, most recently from 2c89c18 to ed83730 Compare October 6, 2016 10:57
@karajas

karajas commented Oct 6, 2016

Copy link
Copy Markdown
Member Author

Resolved the System.Runtime.Loader error, where the restore seems to work only for netstandard1.6

@karajas

karajas commented Oct 6, 2016 •

Copy link
Copy Markdown
Member Author

An important point to note is project.json for tests are no longer required unless you have special compilation requirements.

All test project's will utilize the latest version of all packages from the last checked in build (LKG) , auto update will affect common test-runtime project.json and all project.json with the special rules reducing the noise for each auto update PR.

Another important point to note is that test project's will now compile with all the assets resolved from the common test-runtime project.json, we need to come up with a way to handle opt out references.

@karajas

karajas commented Oct 6, 2016

Copy link
Copy Markdown
Member Author

PTAL.

@karajas
karajas force-pushed the testRestore branch 2 times, most recently from eb23ded to 8548a9f Compare October 6, 2016 18:48
@karajas

karajas commented Oct 6, 2016

Copy link
Copy Markdown
Member Author

Readded all the Project.Json's for System.Runtime.Loader tests and System.Reflection CoreCLR tests.

@karajas

karajas commented Oct 6, 2016

Copy link
Copy Markdown
Member Author

@weshaggard I'll verify the official build against packages scenario doesn't break.

Comment thread src/Common/test-runtime/project.json Outdated
}
}
"dependencies": {
"coveralls.io": "1.4",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file definitely looks very scary. We should really consider generating it.

@karajas karajas Oct 7, 2016 •

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.

This seems like an interesting challenge. The method I used to generate this initially was a aggregation tool across all project.json in the src directory, which is fine but didn't resolve any of the odd restore requirements like having certain dependencies adjacent to each other.

The vetted method for generating this file is

I can do a write up of this part and will definitely look into a better generation story. A lot of it, just involved running sync on the different scenarios and cleaning up the errors.

@weshaggard

Copy link
Copy Markdown
Member

This is awesome. I love seeing a ton of stuff getting deleted and our restore times going down. Thanks @karajas

The change looks good to me but as we chatted lets be sure our official build can handle it.

@karajas

karajas commented Oct 7, 2016 •

Copy link
Copy Markdown
Member Author

So far the official build would break because of this change. I've fixed the related code in buildagainstpackages.targets to omit the common project.json with @chcosta 's help, which I'll open a PR in buildtools for.

Even with this change some of the references need to be changed to get a clean official build against packages, I'm working through those at the moment.

For example in my current change, IsolatedStorage is still in the uap section but needs another copy in the netstandard section so that buildagainstpackages can pick up the compile time asset from packages.

@karajas
karajas force-pushed the testRestore branch 6 times, most recently from 3c416c4 to 255ff91 Compare October 18, 2016 16:54
@karajas

karajas commented Oct 18, 2016

Copy link
Copy Markdown
Member Author

@karajas

karajas commented Oct 18, 2016

Copy link
Copy Markdown
Member Author

@dotnet-bot test Innerloop Windows_NT Debug Build and Test please

@karajas

karajas commented Oct 18, 2016

Copy link
Copy Markdown
Member Author

@weshaggard Verified this passes against official builds. PTAL.

@karajas

karajas commented Oct 18, 2016

Copy link
Copy Markdown
Member Author

@joperezr @stephentoub Can this change go in before we patch the next update dependencies PR?

@weshaggard weshaggard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix the last merge conflict and merge.

@karajas
karajas merged commit 2b91aa8 into dotnet:master Oct 18, 2016
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
macrogreg pushed a commit to open-telemetry/opentelemetry-dotnet-instrumentation that referenced this pull request Sep 24, 2020
Improve sync time with a global test-runtime project.json restore upfront.

Commit migrated from dotnet/corefx@2b91aa8
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Improve sync time with a global test-runtime project.json restore upfront.

Commit migrated from dotnet/corefx@2b91aa8
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants