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:
- Created 6 years ago
- Reactions:4
- Comments:29 (19 by maintainers)
Top GitHub Comments
The problem might not be on
mono
ordotnet 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! 😃https://github.com/dotnet/cli/issues/8103 https://github.com/dotnet/cli/issues/7610 https://github.com/dotnet/cli/issues/7551