question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet new is slow with 3.0 sdk

See original GitHub issue

dotnet new takes much longer with 3.0 sdk. From less than half a second with 2.2, to more than 3 seconds with 3.0:

$ dotnet --version
2.2.108
$ time dotnet new console --no-restore
The template "Console Application" was created successfully.

real	0m0.416s
user	0m0.395s
sys	0m0.039s
$ dotnet --version
3.0.100-preview8-013656
$ time dotnet new console --no-restore
The template "Console Application" was created successfully.

real	0m3.369s
user	0m0.847s
sys	0m0.070s

The message The template "Console Application" was created successfully. appears as fast, but then the program still idle for some time.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
MykolaBalakincommented, Jun 9, 2021

@git-Charlie here is the place in the code: https://github.com/dotnet/templating/blob/v3.1.4/src/Microsoft.TemplateSearch.Common/BlobStoreSourceFileProvider.cs#L33

So setting DOTNET_NEW_LOCAL_SEARCH_FILE_ONLY env variable to 1 disables the update check.

But still… The json returned looks like the whole template package list. So it will work slower with every new community project template added (at least because of more data transferred). Is it expected?

BTW. I’m ready to contribute the fix if smbd from the project team confirms the way to improve the tool (@KathleenDollard). Maybe something like checking updates no more than once per day?

2reactions
DavidKarlascommented, May 19, 2021

This has been addressed in .NET 6 Preview 4, this are major changes here:

  1. We don’t download that 3MB .json anymore but check using NuGet.org API which is much smaller/faster
  2. We execute check in parallel with template creation
  3. We stopped checking for updates for SDK installed templates(console, web…)

We also plan to add option to disable checking for update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Net SDK 3 performance
Hello On my tests, doing a very simple example (100.000 times storing and retrieving a string on the Couchbase server) i saw major ......
Read more >
net core 7 web api very slow first call more that 32s
Hi, I have a problem in EF7 with core 7 web api. The first call take more that 30s and the second call...
Read more >
Performance Improvements in .NET Core 3.0
NET Core 3.0 includes new hardware intrinsics that allow a properly-motivated developer to eke out the best possible performance on ...
Read more >
Performance Improvements in .NET 7
NET 7 is fast. Really fast. This post deep-dives into hundreds of performance improvements that contributed to that reality.
Read more >
What's new in .NET Core 3.0
This article describes what is new in .NET Core 3.0. One of the biggest enhancements is support for Windows desktop applications (Windows only)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found