perf: reduce diagnostics and queued dispatch allocations in 2.3.2
Publish UPM package / publish (push) Successful in 2s
Publish NuGet packages / publish (push) Canceled after 3m12s

This commit is contained in:
cneicy committed 2026-11-06 20:52:09 +08:00
1 parent 901ad18453
commit 0449e82c0c
8 files changed
+152 -36

No files matched your search

@@ -73,6 +73,35 @@ namespace ShrinkEventBus.Tests
Assert.AreEqual(1, secondObserverCalls);
}
[Test]
public void ObserveDiagnostics_MutationsApplyToNextDispatch()
{
var calls = new List<string>();
IDisposable second = null;
IDisposable added = null;
using var first = EventBus.ObserveDiagnostics(_ =>
{
calls.Add("first");
second.Dispose();
if (added == null)
added = EventBus.ObserveDiagnostics(__ => calls.Add("added"));
});
second = EventBus.ObserveDiagnostics(_ => calls.Add("second"));
try
{
EventBus.NotifyDetailedPosted(default);
CollectionAssert.AreEqual(new[] { "first", "second" }, calls);
calls.Clear();
EventBus.NotifyDetailedPosted(default);
CollectionAssert.AreEqual(new[] { "first", "added" }, calls);
}
finally
{
second.Dispose();
added?.Dispose();
}
}
[Test]
public void PostDeferred_DoesNotDispatchBeforePump()
{