chore: release EventBus 2.3.2 and verify standalone allocation behavior
This commit is contained in:
3 files changed
+33
-3
No files matched your search
Submodule Assets/Modules/ShrinkEventBus updated: 901ad18453...b14d6d0117.
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using ShrinkEventBus;
|
||||
|
||||
[TestFixture, NonParallelizable]
|
||||
public class EventBusAllocationTests
|
||||
{
|
||||
private readonly struct ProbeEvent : IShrinkEvent { }
|
||||
|
||||
[Test]
|
||||
public void PublicDiagnosticsDoesNotAllocatePerPostAfterWarmup()
|
||||
{
|
||||
using var host = new ShrinkEventBusHost();
|
||||
var bus = host.CreateBus(new ShrinkBusKey("allocation", "probe"), ShrinkBusOptions.Inline());
|
||||
var calls = 0;
|
||||
using var observer = EventBus.ObserveDiagnostics(_ => calls++);
|
||||
Measure(bus);
|
||||
var allocated = Measure(bus);
|
||||
Assert.That(calls, Is.EqualTo(20000));
|
||||
Assert.That(allocated, Is.Zero);
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
private static long Measure(IShrinkEventBus bus)
|
||||
{
|
||||
var before = GC.GetAllocatedBytesForCurrentThread();
|
||||
for (var i = 0; i < 10000; i++) bus.Post(new ProbeEvent());
|
||||
return GC.GetAllocatedBytesForCurrentThread() - before;
|
||||
}
|
||||
}
|
||||
@@ -160,12 +160,12 @@
|
||||
{
|
||||
"directory": "ShrinkEventBus",
|
||||
"name": "com.cneicy.shrink-eventbus",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"repository": "https://git.crash.work/ShrinkSDK/ShrinkEventBus.git",
|
||||
"nugetPackages": [
|
||||
{
|
||||
"id": "ShrinkSDK.EventBus",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"project": "Assets/Modules/ShrinkEventBus/DotNet~/ShrinkSDK.EventBus.csproj"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user