Improving dotnet publish speed by 8%

Date: 2023-10-11 | create | dotnet |

Recently I investigated improving CloudSeed (my F# / SvelteKit project boilerplate) build speeds. On initial investigation, I found a big bottleneck for cached builds was my backend's dotnet publish step, taking up about 90% of the total build time.

In this post I'll be answering:

Q: How I improved dotnet publish speed by 8%

Answer

I tried several things to speed up the build from dockerignore my build artifacts to separating my fsproj into its own Docker build step. But none of these meaningfully improved the build time, likely cause the dotnet publish bottleneck was unaffected.

The one thing that really made an impact was upgrading the dotnet version I was running from 6 -> 7. This improved dotnet publish (and thus overall cached build) speeds from a median of 7.8s -> 7.2s = 0.6s (8%).

What I found especially remarkable about this upgrade is that nothing broke. It was a full version upgrade but the entire backend continued to work without needs upgrade packages, work around broken apis.

Hard to get meaningful upgrades that easy.

Next

If you liked this post, you might want to read about my other optimizations, reducing CloudSeed Docker build times by 1.3s (14%).

Want more like this?

The best / easiest way to support my work is by subscribing for future updates and sharing with your network.