From dda2bb005b8517b2c82b80e71969ead2a179b482 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 21 Dec 2024 16:13:50 +0900 Subject: [PATCH] rename benchmark namespace --- .../ArrayBenchmarks.cs | 2 +- .../PriorityQueueBenchmarks.cs | 12 ++++---- .../VectorBenchmarks.cs | 29 +++++++++++++------ tool/DotRecast.Tool.Benchmark/Program.cs | 2 +- 4 files changed, 28 insertions(+), 17 deletions(-) rename tool/DotRecast.Tool.Benchmark/{Benchmarks => DotRecast.Core}/ArrayBenchmarks.cs (98%) rename tool/DotRecast.Tool.Benchmark/{Benchmarks => DotRecast.Core}/PriorityQueueBenchmarks.cs (98%) rename tool/DotRecast.Tool.Benchmark/{Benchmarks => DotRecast.Core}/VectorBenchmarks.cs (61%) diff --git a/tool/DotRecast.Tool.Benchmark/Benchmarks/ArrayBenchmarks.cs b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/ArrayBenchmarks.cs similarity index 98% rename from tool/DotRecast.Tool.Benchmark/Benchmarks/ArrayBenchmarks.cs rename to tool/DotRecast.Tool.Benchmark/DotRecast.Core/ArrayBenchmarks.cs index b65a915b..5c7d32ea 100644 --- a/tool/DotRecast.Tool.Benchmark/Benchmarks/ArrayBenchmarks.cs +++ b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/ArrayBenchmarks.cs @@ -3,7 +3,7 @@ using BenchmarkDotNet.Engines; using DotRecast.Core.Buffers; -namespace DotRecast.Tool.Benchmark.Benchmarks; +namespace DotRecast.Tool.Benchmark.DotRecast.Core; /* diff --git a/tool/DotRecast.Tool.Benchmark/Benchmarks/PriorityQueueBenchmarks.cs b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/PriorityQueueBenchmarks.cs similarity index 98% rename from tool/DotRecast.Tool.Benchmark/Benchmarks/PriorityQueueBenchmarks.cs rename to tool/DotRecast.Tool.Benchmark/DotRecast.Core/PriorityQueueBenchmarks.cs index ee6758c2..66c62ad1 100644 --- a/tool/DotRecast.Tool.Benchmark/Benchmarks/PriorityQueueBenchmarks.cs +++ b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/PriorityQueueBenchmarks.cs @@ -3,7 +3,7 @@ using BenchmarkDotNet.Attributes; using DotRecast.Core.Collections; -namespace DotRecast.Tool.Benchmark.Benchmarks; +namespace DotRecast.Tool.Benchmark.DotRecast.Core; /* @@ -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 _sq; private RcBinaryMinHeap _bmHeap; @@ -208,7 +210,7 @@ public void EnqueueDequeue_RcSortedQueue() total = _priority[i], }); } - + for (int i = half; i < Count; i++) { _sq.Enqueue(new Node @@ -219,7 +221,6 @@ public void EnqueueDequeue_RcSortedQueue() _sq.Dequeue(); } - } [Benchmark] @@ -235,7 +236,7 @@ public void EnqueueDequeue_RcBinaryMinHeap() total = _priority[i], }); } - + for (int i = half; i < Count; i++) { _bmHeap.Push(new Node @@ -246,7 +247,6 @@ public void EnqueueDequeue_RcBinaryMinHeap() _bmHeap.Pop(); } - } [Benchmark] diff --git a/tool/DotRecast.Tool.Benchmark/Benchmarks/VectorBenchmarks.cs b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/VectorBenchmarks.cs similarity index 61% rename from tool/DotRecast.Tool.Benchmark/Benchmarks/VectorBenchmarks.cs rename to tool/DotRecast.Tool.Benchmark/DotRecast.Core/VectorBenchmarks.cs index e7619062..99b90ee1 100644 --- a/tool/DotRecast.Tool.Benchmark/Benchmarks/VectorBenchmarks.cs +++ b/tool/DotRecast.Tool.Benchmark/DotRecast.Core/VectorBenchmarks.cs @@ -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(); diff --git a/tool/DotRecast.Tool.Benchmark/Program.cs b/tool/DotRecast.Tool.Benchmark/Program.cs index 62a54098..761d7c61 100644 --- a/tool/DotRecast.Tool.Benchmark/Program.cs +++ b/tool/DotRecast.Tool.Benchmark/Program.cs @@ -1,6 +1,6 @@ using System; using BenchmarkDotNet.Running; -using DotRecast.Tool.Benchmark.Benchmarks; +using DotRecast.Tool.Benchmark.DotRecast.Core; namespace DotRecast.Tool.Benchmark;