Skip to content

Commit eba3d41

Browse files
committed
dotnet: add startup performance test program
1 parent cb7a9ab commit eba3d41

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bin/
2+
obj/
3+
_site/
4+
api/
5+
docs/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace dotnet_perf;
2+
3+
class Program
4+
{
5+
static void Main(string[] args)
6+
{
7+
int x = 2 + 2;
8+
Console.WriteLine(String.Format("2 + 2 = {0}", x));
9+
}
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<RootNamespace>dotnet_perf</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
</Project>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
# dotnet build -c Release
3+
4+
roughly 24/sec
5+
6+
$ time for ((i=0;i<10;i++)) ; do bin/Release/net10.0/dotnet-perf >/dev/null ; done
7+
real 0m0.467s
8+
user 0m0.359s
9+
sys 0m0.096s
10+
11+
$ time for ((i=0;i<100;i++)) ; do bin/Release/net10.0/dotnet-perf >/dev/null ; done
12+
real 0m4.233s
13+
user 0m3.330s
14+
sys 0m0.887s
15+
16+
$ time for ((i=0;i<1000;i++)) ; do bin/Release/net10.0/dotnet-perf >/dev/null ; done
17+
real 0m41.149s
18+
user 0m32.093s
19+
sys 0m9.015s
20+
21+
$ time for ((i=0;i<10000;i++)) ; do bin/Release/net10.0/dotnet-perf >/dev/null ; done
22+
real 6m51.120s
23+
user 5m22.929s
24+
sys 1m27.905s
25+
26+
# dotnet build -c Release --self-contained
27+
28+
roughly 24/sec
29+
30+
$ time for ((i=0;i<10;i++)) ; do bin/Release/net10.0/linux-x64/dotnet-perf >/dev/null ; done
31+
real 0m0.509s
32+
user 0m0.344s
33+
sys 0m0.124s
34+
35+
$ time for ((i=0;i<100;i++)) ; do bin/Release/net10.0/linux-x64/dotnet-perf >/dev/null ; done
36+
real 0m4.208s
37+
user 0m3.275s
38+
sys 0m0.894s
39+
40+
$ time for ((i=0;i<1000;i++)) ; do bin/Release/net10.0/linux-x64/dotnet-perf >/dev/null ; done
41+
real 0m40.971s
42+
user 0m31.909s
43+
sys 0m9.033s
44+
45+
$ time for ((i=0;i<10000;i++)) ; do bin/Release/net10.0/linux-x64/dotnet-perf >/dev/null ; done
46+
real 6m48.798s
47+
user 5m20.406s
48+
sys 1m28.199s
49+
50+
51+
# dotnet publish -r linux-x64 -p:PublishSingleFile=true --self-contained true
52+
53+
roughly 24/sec
54+
55+
$ time for ((i=0;i<10;i++)) ; do bin/Release/net10.0/linux-x64/publish/dotnet-perf >/dev/null ; done
56+
real 0m0.490s
57+
user 0m0.329s
58+
sys 0m0.123s
59+
60+
$ time for ((i=0;i<100;i++)) ; do bin/Release/net10.0/linux-x64/publish/dotnet-perf >/dev/null ; done
61+
real 0m4.117s
62+
user 0m3.286s
63+
sys 0m0.830s
64+
65+
$ time for ((i=0;i<1000;i++)) ; do bin/Release/net10.0/linux-x64/publish/dotnet-perf >/dev/null ; done
66+
real 0m40.340s
67+
user 0m32.257s
68+
sys 0m8.171s
69+
70+
$ time for ((i=0;i<10000;i++)) ; do bin/Release/net10.0/linux-x64/publish/dotnet-perf >/dev/null ; done
71+
real 6m43.044s
72+
user 5m20.058s
73+
sys 1m23.876s
74+

0 commit comments

Comments
 (0)