-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] RAR-as-a-service prototype #3914
Conversation
Looks like a lot of the remaining overhead is due to logging Check out the perf difference if I still capture all build events, but simply don't return them in the final response, mocking what would happen if RAR saw a silent verbosity. This brought RAR-as-a-service to a 17-33% reduction in incremental build times on a cached RAR execution, and a 2-6% performance penalty on a full RAR execution: Single-procDotnet Console - RAR-Service Non-Cached (-12%)
Dotnet Console - RAR-Service Cached (-17%)
WebLarge - RAR-Service Non-Cached (+6%)
WebLarge - RAR-Service Cached (-20%)
Multi-procWebLarge - RAR-Service Non-cached (+2%)
WebLarge - RAR-Service Cached (-33%)
While looking at this, I also found that the reported RAR task time under
the same DotTrace profile shows this when looking at So either something outside the task method is being counted in the overall time, or the time reported is a bit over the actual time. |
fd28126
to
5dd067c
Compare
Closing since we haven't been able to land this yet. Hopefully we can pick it up from this point again. |
Prototype implementation for #3139. So far this results in anywhere from 10-27% reduction in incremental build times on a cached RAR execution, and a 7-8% performance penalty on a full RAR execution.
Still haven't spawned the process from MSBuild, so currently to run this you need to set up a separate project, add a reference to the built Microsoft.Build.Tasks.Core.dll, and write something like this:
Here are sample perf numbers. Overall build time can fluctuate independent of RAR, but is still given just to put into perspective the percentage of time RAR takes up in a build.
Non-cached represents either a first build which would result in RAR fully executing for each project. Since caching is on currently a per-project basis, in a build with many projects e.g. WebLarge, RAR will only execute again if inputs or files used by that specific project have changed, while the rest will hit the cache. So times below are either worst-case or best-case, all cache misses or all cache hits, and real-world times would fall in between the two.
Edit: updated with times from latest commit, % change in build times, and now profiled on my desktop
Single-proc
Dotnet Console - Master
Note: for small projects, a non-cached build will still run faster due to RAR already being JIT'ed
Dotnet Console - RAR-Service Non-Cached (-6%)
Dotnet Console - RAR-Service Cached (-10%)
WebLarge - Master
WebLarge - RAR-Service Non-Cached (+8%)
WebLarge - RAR-Service Cached (-18%)
Multi-proc
Multi-proc is a bit more difficult to measure since tasks times are cumulative in some form, but there's definitely room for improvement. The current locking mechanism just sticks a lock around all the service cache code, which was the easiest/fastest way to get multi-proc working, so I imagine threads are just spending a significant amount of time waiting.
WebLarge Master
WebLarge - RAR-Service Non-cached (+7%)
WebLarge - RAR-Service Cached (-27%)
Todos
ResolveAssemblyReferenceCacheService.cs
Microsoft.CurrentVersion.Targets
to enable/disable RAR running out-of-proc. The property has already been added in RAR, so it's a quick fix.TODO
s still scattered about in the code where I believe overhead reduction is possibleProject Structure
Figure it's worth doing this since there's 45 changed/added files. Most of the code is isolated under
ResolveAssemblyReferences
.IResolveAssemblyReferenceTask.cs
(Tasks.ResolveAssemblyReferences.Task
doesn't exactly roll off the tongue)IResolveAssemblyReferenceService.cs