dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.97k stars 4.91k forks source link

.NET Core 3.0.0 Preview 1 very slow on ARM64 #2122

Closed xoofx closed 5 years ago

xoofx commented 5 years ago

Hey, So I'm testing ..NET Core 3.0.0 Preview 1 on a debian/buster ARM64 and running a simple HelloWorld with dotnet takes more than 1 seconds while running the exact same program with mono takes 0.15s

Is there any known performance issue when running on ARM64?

Output of dotnet --info:

3.0.100-preview-009812
xoofx@rpi3:~$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview-009812
 Commit:    e3abf6e935

Runtime Environment:
 OS Name:     debian
 OS Version:
 OS Platform: Linux
 RID:         debian-arm64
 Base Path:   /home/xoofx/dotnet/sdk/3.0.100-preview-009812/

Host (useful for support):
  Version: 3.0.0-preview-27122-01
  Commit:  00c5c8bc40

.NET Core SDKs installed:
  3.0.100-preview-009812 [/home/xoofx/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0-preview-18579-0056 [/home/xoofx/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0-preview-27122-01 [/home/xoofx/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
karelz commented 5 years ago

@brianrob @billwert do we have some insights into perf on ARM64?

richlander commented 5 years ago

This is what I see on my ARM64 Pinebook.

rich@tofino:~$ cd myapp/
rich@tofino:~/myapp$ cat myapp.csproj 
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

</Project>
rich@tofino:~/myapp$ time ./bin/Debug/netcoreapp3.0/myapp 
Hello World!

real    0m0.872s
user    0m0.480s
sys     0m0.110s
rich@tofino:~/myapp$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview-009812
 Commit:    e3abf6e935

Runtime Environment:
 OS Name:     neon
 OS Version:  18.04
 OS Platform: Linux
 RID:         linux-arm64
 Base Path:   /usr/share/dotnet/sdk/3.0.100-preview-009812/

Host (useful for support):
  Version: 3.0.0-preview1-27018-05
  Commit:  7a7ca06512

.NET Core SDKs installed:
  3.0.100-alpha1-009697 [/usr/share/dotnet/sdk]
  3.0.100-preview-009756 [/usr/share/dotnet/sdk]
  3.0.100-preview-009812 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0-preview-18579-0056re/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0-preview-27114-01 [/ustnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview-27122-01 [/ustnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview1-27018-05 [/uotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
rich@tofino:~/myapp$

This is what I see on Windows X64 for the same build. It is a 10x difference.

C:\Users\rlander\app30> (measure-command { .\bin\Debug\netcoreapp3.0\app30.exe }).TotalSeconds
0.0786411
xoofx commented 5 years ago

@richlander could you try mono on ARM64? This is where I'm seeing a significant difference.

xoofx commented 5 years ago

On my Raspberry Pi, I'm getting the following for dotnet:

xoofx@ubuntu:~/work/HelloWorld/bin/Release/netcoreapp3.0$ time dotnet HelloWorld.dll
Hello World!

real    0m0.439s
user    0m0.395s
sys     0m0.056s

while with mono:

xoofx@ubuntu:~/work/HelloWorld/bin/Release/netcoreapp3.0$ time mono HelloWorld.dll
Hello World!

real    0m0.264s
user    0m0.243s
sys     0m0.022s

For some reasons, it is less dramatic than my earlier test (maybe I screwed up by using dotnet run instead of calling directly the dotnet HelloWorld.dll), but nonetheless, dotnet is still almost 2 times slower than mono, while usually, it is running faster. Running the same program on ARM32 and you will get different results.

xoofx commented 5 years ago

Just tested this on a new RockPro64 I received:

With latest dotnet:

xoofx@rockpro64:~/work/HelloWorld/bin/Release/netcoreapp3.0$ time dotnet HelloWorld.dll
Hello World!

real    0m0.284s
user    0m0.255s
sys     0m0.039s

With Mono:

xoofx@rockpro64:~/work/HelloWorld/bin/Release/netcoreapp3.0$ time mono HelloWorld.dll
Hello World!

real    0m0.101s
user    0m0.082s
sys     0m0.018s

So we can see that dotnet is 2/3 times slower than mono, so there is clearly an issue on arm64.

shouhujishu commented 5 years ago

root@aml:~# cd app root@aml:~/app# dotnet run Hello World!

Get output after 7 seconds

Linux version 4.18.7-aml-s9xxx (root@aml) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP PREEMPT Thu Jan 3 06:41:31 UTC 2019

RAM:2GB ROM:KLM8G1GEME,8GB eMMC CPU:Amlogic S905,ARM Cortex-A53

karelz commented 5 years ago

@brianrob @billwert ping? cc @adamsitnik

carlossanlop commented 5 years ago

No comments since January. @xoofx please open a new issue if you find the same perf problems in 3.0 Release.