-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Parallelize restore logic of missing packages #14243
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
Conversation
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs
Fixed
Show fixed
Hide fixed
b04c661
to
294b0f5
Compare
2388027
to
c78cd73
Compare
Sample log messages when running work on multiple threads:
|
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.
This is much nicer! Well done!
}) | ||
.ToList(); | ||
foreach (var line in stdoutLines) | ||
Parallel.ForEach(projects, new ParallelOptions { MaxDegreeOfParallelism = options.Threads }, project => |
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.
Out of curiosity: Did you measure the performance impact of using this "Parallel" library instead of PLINQ?
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.
In any case, this is much nicer :-)
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.
I haven't. But I'm under the impression that they do the same.
var threadId = $"[{Environment.CurrentManagedThreadId:D3}]"; | ||
void onOut(string s) | ||
{ | ||
Console.Out.WriteLine($"{threadId} {s}"); |
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.
nit: Could be inlined as lambdas?
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.
Yes, it could be. (I think in general local functions perform better than lambdas. But not in this case, because we're passing the local function as an Action
delegate.)
This PR
DependencyManager.DownloadMissingPackages
,Process
starting logic.Commit-by-commit review is suggested.