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.

Slow performance for --include with single file

See original GitHub issue

Hi, I’m just experimenting with dotnet-format for the first time. I noticed that running it on a single file has more overhead than I would expect.

# Run on 223 files 
$ git ls-files | grep .cs$  > all_cs.txt
$ dotnet format --folder --include @all_cs.txt
  Formatting code files in workspace '/xyz/ml-agents'.
  ...
  Format complete in 2297ms.

# Run on 1 file
$ dotnet format --folder --include com.unity.ml-agents/Tests/Editor/MultinomialTest.cs
  Formatting code files in workspace '/xyz/ml-agents'.
  Format complete in 1325ms.

Is that expected? It’s not horrible, but it would be mildly annoying to run incrementally on git commits.

Platform/version information: MacOS 10.14.6

$ dotnet --version
3.1.401
$ dotnet-format --version
4.1.131201+82a5527cd93d66bffc885c0bb901499f5981db35

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:25
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

12reactions
aradalvandcommented, Nov 7, 2022

Same here. This is the single biggest problem dotnet format suffers from. It’s simply unacceptable that it takes multiple seconds to format a single file. Formatters built into Visual Studio or the OmniSharp extension for VS Code typically take under 500 milliseconds to format a single small-to-medium-sized file.

Similar tools in other ecosystems such as go fmt or prettier are much, much more performant as well. This issue needs to be given higher priority, I’d argue.

@jmarolf @JoeRobich Sorry to tag you guys, but just wanted to get some updates on this. Have you guys managed to identify the root cause of this yet?

11reactions
codec-abccommented, Apr 12, 2022

Is this issue actively working on? I am under the impression that dotnet format is somewhat slow which make make it annoying to run locally before committing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity-framework code is slow when using Include() many ...
If at least one entity does not have a relationship to some of other entities, then EF will not able to construct one...
Read more >
does having code spread in multiple files decrease ...
In large projects, using a single file to store source code greatly reduces code quality and development efficiency. It brings negligible  ...
Read more >
System stops responding, slow file server performance, or ...
System stops responding, slow file server performance, or delays occur when you work with files that are located on a file server.
Read more >
Huge drop in read performance between single file vs. ...
When transferring a large single file from storage server (Z: ) to editing (D: or C: ), I have sustained transfer speed of...
Read more >
How many files can you put in a Windows folder without ...
I'm guessing there's no hard limit, but I know that performance degrades when you put too many files into a single Windows folder....
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