Skip to content

Commit 9346949

Browse files
committed
Added Sqrt benchmark, updated run script. 0.1.0 release.
1 parent 9f76a9f commit 9346949

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

jemalloc.Benchmarks/Benchmarks/NativeVsManagedArray.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public void CreateManagedArray()
3434
public void CreateNativeArray()
3535
{
3636
SafeArray<T> array = new SafeArray<T>(ArraySize);
37+
array.Release();
3738
}
3839

3940
[Benchmark(Description = "Fill a managed array with a single value.")]
@@ -75,6 +76,26 @@ public void ArithmeticMultiplyNativeArray()
7576
T r = nativeArray[ArraySize / 2];
7677
}
7778

79+
[Benchmark(Description = "Fill all values of a managed array with a single value and then compute the square root.")]
80+
[BenchmarkCategory("Arithmetic")]
81+
public void ArithmeticSqrtManagedArray()
82+
{
83+
for (int i = 0; i < managedArray.Length; i++)
84+
{
85+
managedArray[i] = JemUtil.ValToGenericStruct<uint, T>(256u);
86+
JemUtil.GenericSqrt(managedArray[i]);
87+
}
88+
}
89+
90+
[Benchmark(Description = "Fill all values of a native array with a single value and then compute the square root.")]
91+
[BenchmarkCategory("Arithmetic")]
92+
public void ArithmeticSqrtNativeArray()
93+
{
94+
nativeArray.Fill(JemUtil.ValToGenericStruct<uint, T>(256u));
95+
nativeArray.VectorSqrt();
96+
}
97+
98+
7899
protected T[] managedArray;
79100
protected SafeArray<T> nativeArray;
80101
protected T fill;

jembench.cmd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
@echo off
2-
set OLDPATH=%PATH%
3-
set PATH=%PATH%;%cd%\x64\Debug
42
dotnet .\x64\Release\netcoreapp2.0\jemalloc.Cli.dll %*
5-
set PATH=%OLDPATH%
63
:end

0 commit comments

Comments
 (0)