-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Avoid explicitly restoring projects in solution files. #14111
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
C#: Avoid explicitly restoring projects in solution files. #14111
Conversation
1d86206
to
f41830f
Compare
f41830f
to
e256144
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some questions and suggestions. Have you checked how the performance changes simply with using multiple threads for the restores?
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs
Outdated
Show resolved
Hide resolved
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs
Outdated
Show resolved
Hide resolved
No, I have not - I will try that 👍 |
Result for only executing project restore in parallel can be seen below. Execution time when restoring projects in parallel (without using info from restore of solution).Results for OrchardCMS/OrchardCore python3 diff_standalone.py 2123.84s user 421.09s system 289% cpu 14:38.71 total |
I re-ran the performance experiment (locally) for not using project information from .NET restore after explicitly deleting the |
e256144
to
0127b77
Compare
Ran the extraction locally.
In this case we get a significant improvement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In this PR we do the following performance optimisations to the dependency manager.
dotnet restore
(after restoring the solution).dotnet restore
on projects are executed in parallel.A couple of implementation details
dotnet restore
verbosity level tonormal
when restoring solutions to get all the relevant information related to restored projects.DotNet.cs
file is starting to contain business logic. In C#: Re-factor Dotnet.cs to enable unit testing. #14142 we re-factorDotNet.cs
to enable unit testing.The changes have been tested on
OrchardCMS/OrchardCore
as it contains a solution file.The numbers below show that we get the same accuracy for the comparison queries, but the wall clock time drops from approximately 16m to 9m (on my machine).
On main we have:
Results for OrchardCMS/OrchardCore
Query Files.ql:
Result count - both/traced/standalone: 4151/3692/20
Query Declarations.ql:
Result count - both/traced/standalone: 69128/84740/113
Result count in the matching 4151 files - both/traced/standalone: 69128/0/0
Matching 100.0%
Query Dependencies.ql:
Result count - both/traced/standalone: 491/2/229
Query CallTargets.ql:
Result count - both/traced/standalone: 87430/264261/213
Result count in the matching 4151 files - both/traced/standalone: 87430/1523/154
Matching 98.12%
Query TypeHierarchy.ql:
Result count - both/traced/standalone: 6351/4027/23
Result count in the matching 4151 files - both/traced/standalone: 6351/7/5
Matching 99.81%
Query Expressions.ql:
Result count - both/traced/standalone: 311660/1070097/1049
Result count in the matching 4151 files - both/traced/standalone: 311660/6370/870
Matching 97.73%
Query VariableAccesses.ql:
Result count - both/traced/standalone: 86270/193815/39
Result count in the matching 4151 files - both/traced/standalone: 86270/363/0
Matching 99.58%
Query TypeMentions.ql:
Result count - both/traced/standalone: 86709/131893/396
Result count in the matching 4151 files - both/traced/standalone: 86709/1439/319
Matching 98.01%
python3 diff_standalone.py 1510.23s user 299.76s system 188% cpu 15:58.18 total
On the feature branch including the unit test re-factor we have
Results for OrchardCMS/OrchardCore
Query Files.ql:
Result count - both/traced/standalone: 4151/3692/20
Query Declarations.ql:
Result count - both/traced/standalone: 69128/84740/113
Result count in the matching 4151 files - both/traced/standalone: 69128/0/0
Matching 100.0%
Query Dependencies.ql:
Result count - both/traced/standalone: 491/2/229
Query CallTargets.ql:
Result count - both/traced/standalone: 87439/264252/206
Result count in the matching 4151 files - both/traced/standalone: 87439/1514/147
Matching 98.14%
Query TypeHierarchy.ql:
Result count - both/traced/standalone: 6351/4027/23
Result count in the matching 4151 files - both/traced/standalone: 6351/7/5
Matching 99.81%
Query Expressions.ql:
Result count - both/traced/standalone: 311657/1070100/1056
Result count in the matching 4151 files - both/traced/standalone: 311657/6373/877
Matching 97.73%
Query VariableAccesses.ql:
Result count - both/traced/standalone: 86271/193814/39
Result count in the matching 4151 files - both/traced/standalone: 86271/362/0
Matching 99.58%
Query TypeMentions.ql:
Result count - both/traced/standalone: 86709/131893/396
Result count in the matching 4151 files - both/traced/standalone: 86709/1439/319
Matching 98.01%
python3 diff_standalone.py 1107.11s user 143.95s system 234% cpu 8:53.80 total