-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Version Used:
.NET 10
FWIW, on my machine:
dotnet --list-sdks
9.0.311 [C:\Program Files\dotnet\sdk]
10.0.103 [C:\Program Files\dotnet\sdk]
10.0.200-preview.0.26103.119 [C:\Program Files\dotnet\sdk]
Steps to Reproduce:
- Go to this branch of the repository and clone it: https://github.com/JasonBock/NumberTheoreticTransform/tree/1-Create-Working-Version-of-Original-Code
- Build the solution:
dotnet build .\NumberTheoreticTransform.slnx
Expected Behavior:
The code builds in seconds.
Actual Behavior:
The code builds in 16 minutes:
To give a bit of background on this code, this is basically the code I wrote for my master's thesis in 1995. That was done in C, and what I'm trying to do is to reproduce it as closely as I can in C#, mostly for historical purposes. The code is bad - like, really bad - as I really didn't know what I was doing 30 years ago :). But, I was hoping I could do a decent 1-to-1-ish translation. The end result is a Program.cs with about 2.4K LOCs, but I was kind of shocked to see just how long it would take to build this. (I know the C code in 1995 didn't take this long to compile!).
The computer I'm building this on...without getting into specs, it's only a year or so old, and all of the C# development I've done on it has always compiled in the "seconds" range. Never seen anything take this long.
I'm guessing there's something to the structure of the code that's doing ... something that Roslyn doesn't really like. The mpmult() function has a bunch of nested for loops, maybe that's the issue. I don't think this is necessarily uncovering a bug in Roslyn, but it is a curiously that the compile time is as long as it is. If there's something I need to restructure to make the build go faster, I'm willing to do that....just not sure where to start with this.
(Side note: The resulting EXE has an exception when it runs, but that's something I'm 99.999% confident is in my code that I need to fix, and not an issue with the compiler itself. However, given how long it takes to compile, I haven't spent time trying to figure out what the issue is.)