Skip to content

Commit

Permalink
rename benchmark namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Dec 21, 2024
1 parent b1c860e commit dda2bb0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BenchmarkDotNet.Engines;
using DotRecast.Core.Buffers;

namespace DotRecast.Tool.Benchmark.Benchmarks;
namespace DotRecast.Tool.Benchmark.DotRecast.Core;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BenchmarkDotNet.Attributes;
using DotRecast.Core.Collections;

namespace DotRecast.Tool.Benchmark.Benchmarks;
namespace DotRecast.Tool.Benchmark.DotRecast.Core;

/*
Expand Down Expand Up @@ -55,9 +55,11 @@ .NET SDK 8.0.101
*/

[MemoryDiagnoser]
public class PriorityQueueBenchmarks
{
[Params(10, 100, 1000, 10000)] public int Count;
[Params(10, 100, 1000, 10000)]
public int Count;

private RcSortedQueue<Node> _sq;
private RcBinaryMinHeap<Node> _bmHeap;
Expand Down Expand Up @@ -208,7 +210,7 @@ public void EnqueueDequeue_RcSortedQueue()
total = _priority[i],
});
}

for (int i = half; i < Count; i++)
{
_sq.Enqueue(new Node
Expand All @@ -219,7 +221,6 @@ public void EnqueueDequeue_RcSortedQueue()

_sq.Dequeue();
}

}

[Benchmark]
Expand All @@ -235,7 +236,7 @@ public void EnqueueDequeue_RcBinaryMinHeap()
total = _priority[i],
});
}

for (int i = half; i < Count; i++)
{
_bmHeap.Push(new Node
Expand All @@ -246,7 +247,6 @@ public void EnqueueDequeue_RcBinaryMinHeap()

_bmHeap.Pop();
}

}

[Benchmark]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
using BenchmarkDotNet.Engines;
using DotRecast.Core.Numerics;

namespace DotRecast.Tool.Benchmark.Benchmarks;
namespace DotRecast.Tool.Benchmark.DotRecast.Core;

/*
| Method | Mean | Error | StdDev |
|------------------ |----------:|----------:|----------:|
| Dot_Vector3 | 0.6395 ns | 0.0125 ns | 0.0104 ns |
| Dot_RcVec3f | 0.2275 ns | 0.0281 ns | 0.0375 ns |
| Cross_Vector3 | 1.1652 ns | 0.0102 ns | 0.0085 ns |
| Cross_RcVec3f | 1.1687 ns | 0.0140 ns | 0.0124 ns |
| Normalize_Vector3 | 1.7964 ns | 0.0173 ns | 0.0162 ns |
| Normalize_RcVec3f | 1.2806 ns | 0.0088 ns | 0.0078 ns |
// * Summary *
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605)
AMD Ryzen 5 5625U with Radeon Graphics, 1 CPU, 12 logical and 6 physical cores
.NET SDK 9.0.100
[Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
DefaultJob : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Allocated |
|------------------ |----------:|----------:|----------:|----------:|
| Dot_Vector3 | 0.4205 ns | 0.0023 ns | 0.0020 ns | - |
| Dot_RcVec3f | 0.0560 ns | 0.0164 ns | 0.0145 ns | - |
| Cross_Vector3 | 1.3648 ns | 0.0406 ns | 0.0380 ns | - |
| Cross_RcVec3f | 1.2007 ns | 0.0279 ns | 0.0233 ns | - |
| Normalize_Vector3 | 1.4201 ns | 0.0210 ns | 0.0186 ns | - |
| Normalize_RcVec3f | 1.1737 ns | 0.0090 ns | 0.0084 ns | - |
*/

[MemoryDiagnoser]
public class VectorBenchmarks
{
private readonly Consumer _consumer = new();
Expand Down
2 changes: 1 addition & 1 deletion tool/DotRecast.Tool.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using BenchmarkDotNet.Running;
using DotRecast.Tool.Benchmark.Benchmarks;
using DotRecast.Tool.Benchmark.DotRecast.Core;

namespace DotRecast.Tool.Benchmark;

Expand Down

0 comments on commit dda2bb0

Please sign in to comment.