We ended up rewriting NuGet Restore in .NET 9
a year ago
- #.NET
- #NuGet
- #Performance
- NuGet Restore algorithm was rewritten to improve performance and scalability, reducing restore times significantly.
- Initial optimizations cut restore times in half, but a full rewrite achieved a 16x improvement (from ~32 mins to ~2 mins).
- The new algorithm avoids recursion and duplicate nodes, reducing memory usage and improving efficiency.
- Collaboration across NuGet, Visual Studio, and .NET teams was key to the project's success.
- The rewrite involved extensive testing, including automated tests, real-life repository tests, and dogfooding.
- Performance improvements led to significant cost savings and productivity gains for large repositories.
- Future work includes addressing known regressions, adding more parallelism, and enabling the new resolver for lock files.
- Key learnings: performance unlocks value, fresh perspectives help, and robust testing is essential.