-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,7 @@ msbuild.err | |
msbuild.wrn | ||
|
||
# Visual Studio 2015 | ||
.vs/ | ||
.vs/ | ||
|
||
*.class | ||
perf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Performance | ||
|
||
Platform: Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz / 16GB 1600 MHz DDR3 | ||
|
||
```sh | ||
$ clang --version | ||
Apple clang version 11.0.0 (clang-1100.0.33.12) | ||
Target: x86_64-apple-darwin19.0.0 | ||
$ clang -O3 perf.c -o perf | ||
$ time ./perf | ||
0.66 real 0.64 user 0.00 sys | ||
$ time for i in {1..30}; do ./perf; done | ||
real 0m19.697s | ||
user 0m19.356s | ||
sys 0m0.086s | ||
``` | ||
|
||
```sh | ||
$ java --version | ||
openjdk 11.0.4 2019-07-16 | ||
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11) | ||
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode) | ||
$ javac Perf.java | ||
$ time java Perf | ||
2.83 real 2.74 user 0.04 sys | ||
$ time for i in {1..30}; do java Perf; done | ||
real 1m23.663s | ||
user 1m21.008s | ||
sys 0m1.173s | ||
``` | ||
|
||
```sh | ||
$dotnet --version | ||
3.0.100 | ||
$ dotnet publish -r osx-x64 -c release /p:PublishSingleFile=true | ||
$ time bin/release/netcoreapp3.0/osx-x64/publish/perfs | ||
1.08 real 1.04 user 0.03 sys | ||
$ time for i in {1..30}; do bin/release/netcoreapp3.0/osx-x64/publish/perfs; done | ||
real 0m38.211s | ||
user 0m31.473s | ||
sys 0m0.958s | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <math.h> | ||
#include <stdlib.h> | ||
|
||
long Sum(long a, long b){ | ||
return a + b + rand(); | ||
} | ||
|
||
int main(void){ | ||
long sum = 0; | ||
for (long count = 0; count < pow(10,8); count++) | ||
{ | ||
sum = Sum(sum, count); | ||
} | ||
return (int)sum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
namespace perfs | ||
{ | ||
class Program | ||
{ | ||
private static readonly Random random = new Random(); | ||
|
||
static long Sum(long a, long b) | ||
{ | ||
return a + b + random.Next(); | ||
} | ||
static void Main(string[] args) | ||
{ | ||
long sum = 0; | ||
for (long count = 0; count < Math.Pow(10, 8); count++) | ||
{ | ||
sum = Sum(sum, count); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import java.lang.Math; | ||
import java.util.Random; | ||
|
||
public class Perf { | ||
private static Random random = new Random(); | ||
|
||
public static long Sum(long a, long b){ | ||
return a + b + random.nextInt(); | ||
} | ||
|
||
public static void main(String args[]) { | ||
long sum = 0; | ||
for(long count = 0; count < Math.pow(10, 8); count++) | ||
{ | ||
sum = Sum(sum, count); | ||
} | ||
} | ||
} |