"Building .NET project..." for 1-2 seconds, when there are no changes. Incremental builds?

Godot Version

4.2 stable mono

Question

When running a scene, Godot (with Mono) shows the window: “Building .NET project…” Waiting for 1-2 seconds. Even if it’s a test project with one empty C# script and there are no changes in it. 1-2 seconds. .NET uses incremental builds. I suppose that Godot uses it either, no? Or why does it happen?

I can’t claim to be an expert, but 1-2 seconds for a build process to check for modified files to build doesn’t sound unreasonable.

I think the short answer is “because that’s quick enough”. There’s no need to expend effort to improve build times in the niche case where there is no need to perform a build.

The point is - there is nothing to build. There is 1 empty class without changes. So it shouldn’t take 2 seconds at all. That’s how incremental build works.

1 Like

Godot does need to rebuild if there are exported variables from C# scripts, so that may be something.

Is there a non-obvious reason why Godot should rebuild all C# files, even without any changes?

I am unsure on that one. It might be buried in a documentation page somewhere. Sorry I can’t be more helpful.

1 Like

Oh, guys, I deleted cs-file, so it’s empty project now. Only 1 scene with a sprite. NO C# scripts at all. Still building .NET project for 2 seconds.

Hello :wave:
If you’re interested in the .NET build process, you can enable binary logs in Godot (editor settings, dotnet, build, create binary log). Those can be open with dedicated tools like MSBuildStructuredLog. Might give some intel about the numerous compilation steps involved, and will show the actual difference between a full and a partial build.

2 Likes

Also the fact that this happens even without a cs-file could suggest that this is a baseline cost and not an actual build cost.

Hi, paulloz :slight_smile: Thanks for the advice! Binary log shows:

It took 754 ms only on the .NET end.

So, I still wonder, why Godot shows “building .NET project…” for 2 seconds, even if .NET build takes 754 ms.

Not sure why moderators moved this topic to Help, because I don’t ask for help, but point out a performance problem and invite C# developers to discuss it. Ok, let it be. :slight_smile:

Currently, looks like this inconvenient delay can be easily optimized.

1 Like

Yes, at least checked, let we know if you find more info, thanks, and if you need support to.