From 0d5bf9d830d5b5147bbb1a90b58f1d4f1759eeee Mon Sep 17 00:00:00 2001 From: mischa Date: Sat, 20 Jul 2024 19:44:33 +0200 Subject: [PATCH] OR perf test --- .../AckDeltaCompressionTests.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Assets/Mirror/Tests/Editor/AckDeltaCompression/AckDeltaCompressionTests.cs b/Assets/Mirror/Tests/Editor/AckDeltaCompression/AckDeltaCompressionTests.cs index aa4a97d90..47fc31cbe 100644 --- a/Assets/Mirror/Tests/Editor/AckDeltaCompression/AckDeltaCompressionTests.cs +++ b/Assets/Mirror/Tests/Editor/AckDeltaCompression/AckDeltaCompressionTests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics; using NUnit.Framework; namespace Mirror.Tests.AckDeltaCompressionTests @@ -133,5 +134,29 @@ public void UpdateIdentityAcks() Assert.That(identityAcks[1337], Is.EqualTo(3.0)); // already newer Assert.That(identityAcks[101], Is.EqualTo(3.0)); // already newer } + + [Test] + public void ORperf() + { + // we are going to need to OR quite a lot of dirty history. + // let's see if this is fast enough at all. + // 100.000 entities need 49 ms. + // 10.000 entities need 5 ms. hm that's quite a lot. + Stopwatch watch = Stopwatch.StartNew(); + for (int identity = 0; identity < 100_000; ++identity) + { + for (int comp = 0; comp < 5; ++comp) + { + ulong mask = 0; + for (int history = 0; history < 60 * 3; ++history) + { + mask |= (ulong)1 << history; + } + } + } + watch.Stop(); + UnityEngine.Debug.Log("ORperf: " + watch.ElapsedMilliseconds + "ms"); + + } } }