chore: release EventBus 2.3.2 and verify standalone allocation behavior
Validate ShrinkSDK Workspace / catalog (push) Failing after 5s
Validate ShrinkSDK Workspace / unity (push) Skipped

This commit is contained in:
cneicy committed 2026-11-06 21:01:16 +08:00
1 parent ad80d488d1
commit 0bffb65ae9
3 files changed
+33 -3

No files matched your search

@@ -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;
}
}
+2 -2
View File
@@ -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"
}
]