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.

CLR performance Linux versus Windows

See original GitHub issue

@polarapfel commented on Tue Apr 04 2017

Hi there,

Running version 1.0.1, creating a new console application using the default template, I noticed that the CLR takes up to two seconds on Linux to initialize before executing the “Hello World” binary from the default template. On Windows (same machine spec), the execution is instant.

Is this a known issue?

thanks,

Tobias W.


@benaadams commented on Tue Apr 04 2017

What if you build first?

dotnet restore
dotnet build -c Release
dotnet run -c Release

@polarapfel commented on Tue Apr 04 2017

Yes. Still takes two seconds to initialize the CLR before the binary executes. Both the release and the debug binaries compiled with dotnet run instantly on the latest Mono runtime on the same Ubuntu system.


@polarapfel commented on Tue Apr 04 2017

@shahid-pk I ran against both for comparison.

On the same Ubuntu system, a binary compiled with dotnet (both release and debug) have different execution times on the dotnet CLR Windows versus Linux. The binary on Windows starts executing instantly after invoking the CLR. The binary on Linux has to wait around 2 seconds for the CLR to initialize (I know because I put a Console.Write with the system timestamp into main()).

Doing the same comparison on Linux with the dotnet CLR versus the Mono runtime, the binary executes instantly on Mono, the dotnet CLR takes around 2 seconds to initialize before it executes the binary.

This is bad and cannot be intentional. I didn’t find any tickets pointing to this issue but I’m sure someone else must have noticed?!

thanks,

Tobias W.


@janvorli commented on Tue Apr 04 2017

@polarapfel It seems it is specific to the dotnet run. If I run hello world using just dotnet with path to the target dll, it takes about 100 ms to complete:

time ../dotnet ~/dotnet/test/bin/Release/netcoreapp1.1/test.dll
Hello World!

real    0m0.090s
user    0m0.079s
sys     0m0.011s

However, running it via the dotnet tool using dotnet run command, I can reproduce the time you were getting:

time ../dotnet run -c Release
Hello World!

real    0m2.329s
user    0m2.228s
sys     0m0.260s

@polarapfel commented on Tue Apr 04 2017

Yeah, that’s right. Curious. Why is that? What happens when the “run” command is invoked within the CLR?

And also, why does the “run” command behave so differently on Windows (fast/instant) versus Linux (slow init)?


@janvorli commented on Tue Apr 04 2017

@polarapfel let me move this issue to cli repo since it is clearly a problem of the cli.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:29 (19 by maintainers)

github_iconTop GitHub Comments

4reactions
jobs-gitcommented, Nov 23, 2017

The problem might not be on mono or dotnet run. Its because Linux’s library resolution is retard.

Specially the ld.so, that is were most of the slowness comes from!

I benchmark one program, its a big big program by the way, and ld.so resolution takes up about 80% of the 30min-1hr runtime!

F** who designed the ld.so, its so retard! Now for mono, somebody got to find its “ld.so” counterpart and fix it! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLR performance Linux versus Windows · Issue #8068
Running version 1.0.1, creating a new console application using the default template, I noticed that the CLR takes up to two seconds on...
Read more >
Is the .NET CLR for windows different than from of Linux or ...
A very broad question and simple answer is Yes, but only a part of CLR would be targeting the specific OS. This is...
Read more >
.NET Core performance on Linux : r/dotnet
The CLR on windows (both Framework and Core) does not use IOCP unless explicitly used. ... .NET has great performance on Linux.
Read more >
I heard so many times that JVM is much better than CLR ...
I heard so many times that JVM is much better than CLR, especially in the JIT area (Hotspot?). If it's true, do the...
Read more >
Performance of CLR Integration - SQL Server
CLR functions that are computing-intensive and that do not perform data access are better written in managed code. Transact-SQL functions do, ...
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