-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
50x slower build with .net 6.0.403 compared to 6.0.402 #66475
Comments
I had some troubles reproducing the issue (as of today, it does not happen reliably any more), but finally I got a log |
I managed to boil it down to a reproducible example project. The below project should build quickly (with errors) on 6.0.402 but it takes a long time (did not measure) with high CPU load if you run Adjust the global.json as needed. |
The example project is also very slow to build with Windows 11 x64 and .net SDK 7.0.101 so it seems to reproduce quite well. |
Thanks for the binlog, and sorry for the long delay here. The binlog shows that all of the time (more than 55 minutes) is spent in Csc - the C# compiler itself. I'm going to move to dotnet/roslyn for further analysis. |
It looks like most of the time is spent within the call to The perf issue repros with .NET 6.0.405 but does not repro with .NET 7.0.102. [Correction: The does repro with .NET 7.0.102.] |
Can you make this byte[] into a resource instead? |
The perf issue results from The following hits the perf issue: int n = 100000;
var builder = new StringBuilder();
builder.Append("int[] values = new[] { ");
for (int i = 0; i < n; i++) builder.Append("0, ");
builder.AppendLine("};");
var tree = CSharpSyntaxTree.ParseText(builder.ToString());
var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
foreach (var child in node.ChildNodesAndTokens().Reverse())
{
_ = child.ToString();
} |
I just tried this on my work laptop:
Were you running a preview version?
We "solved" this issue by pinning .net 6 to version 6.0.402 and (in addition) just removing the byte arrays. Nevertheless I think that other people may encounter this slowdown as well and it would be nice to fix it. |
Thanks @jfheins, you're correct, this does repro with .NET 7.0.102. I've updated my comment above. |
Describe the bug
With the new path release of .net 6, our build times increased significantly.
A
dotnet publish
that takes under one minute with .net 6.0.402 now takes about 50 minutes with .net 6.0.403We see this behaviour in our self-hosted agents (running Ubuntu) but I can also reproduce this locally on Mac M1.
with the pipeline step:
To Reproduce
Unfortunately this does not seem to reproduce on small example projects. But I am happy to run the CLI or the Azure pipeline with added diagnostic if that helps.
Further technical details
Pipeline log with timestamp:
So it seems to be one project that takes long (out of 90 or so) but it is not always the same project.
Locally, I ran dotnet build and this is what I got:
And with 6.0.403:
The text was updated successfully, but these errors were encountered: