From f81975d97a0f641dae45f07b81920114b3b69e47 Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 30 Apr 2024 00:13:42 +0900 Subject: [PATCH] benchmark --- test/DotRecast.Detour.Test/RandomPointTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/DotRecast.Detour.Test/RandomPointTest.cs b/test/DotRecast.Detour.Test/RandomPointTest.cs index c98079f..dccaf0f 100644 --- a/test/DotRecast.Detour.Test/RandomPointTest.cs +++ b/test/DotRecast.Detour.Test/RandomPointTest.cs @@ -29,11 +29,14 @@ namespace DotRecast.Detour.Test; public class RandomPointTest : AbstractDetourTest { [Test] + [Repeat(10)] public void TestRandom() { RcRand f = new RcRand(1); IDtQueryFilter filter = new DtQueryDefaultFilter(); - for (int i = 0; i < 1000; i++) + + var begin = RcFrequency.Ticks; + for (int i = 0; i < 10000; i++) { var status = query.FindRandomPoint(filter, f, out var randomRef, out var randomPt); Assert.That(status.Succeeded(), Is.True); @@ -55,6 +58,9 @@ public class RandomPointTest : AbstractDetourTest Assert.That(randomPt.Z >= bmin[1], Is.True); Assert.That(randomPt.Z <= bmax[1], Is.True); } + + var ticks = RcFrequency.Ticks - begin; + Console.WriteLine($"RandomPointTest::TestRandom() - {(double)ticks / TimeSpan.TicksPerMillisecond} ms"); } [Test]