feat(eventbus): add platform runtimes and benchmarks

Add the Entities NativeQueue adapter, standalone .NET runtime and source generator, reproducible smoke coverage, and Unity benchmark assets for EventBus 2.0.
This commit is contained in:
2026-08-26 01:17:39 +08:00
parent ad5a7b68a3
commit 724e0bc8d8
32 changed files with 1813 additions and 0 deletions
@@ -0,0 +1,72 @@
ShrinkEventBus 2.0 Benchmark Report
===================================
Date: 2026-08-24
Unity: 2022.3.62f3
Platform: WindowsEditor, Play Mode
Host: independent ShrinkEventBusHost, Inline scheduler
Diagnostics: independent Host; detailed global capture does not observe it
Final run: iter=10,000,000 mass=1,000,000 reg=5,000, three rounds
Median results
--------------
Post / 0 handlers
129,282,649 ops/s
Post / 1 handler
67,249,586 ops/s
Post / 8 handlers, struct payload
35,024,798 ops/s
Post / 8 handlers, class payload
25,321,199 ops/s
Post / 30 handlers
10,823,612 ops/s
Post / canceled skips 10
9,029,517 ops/s
PostAsync / 1 async handler
5,909,446 ops/s
Generated Attach + Dispose
674,291 ops/s
Struct hot path allocation
0 B / 10,000,000 Post operations
Comparison
----------
Supplied MessagePipe chart, class payload, 8 handlers:
25,639,260 publish/s
ShrinkEventBus 2.0, class payload, 8 handlers:
25,321,199 publish/s median
ShrinkEventBus 2.0, struct payload, 8 handlers:
35,024,798 publish/s median
Supplied ShrinkEventBus 1.3.0 sample:
0 handlers: 8,971,378 -> 129,282,649 ops/s
1 handler: 6,132,242 -> 67,249,586 ops/s
30 handlers: 258,805 -> 10,823,612 ops/s
canceled skips 10: 1,894,776 -> 9,029,517 ops/s
1 async handler: 1,168,634 -> 5,909,446 ops/s
instance scan/register: 76,353 -> 674,291 generated Attach/s
Implementation notes
--------------------
- Inline buses use a dedicated implementation so the JIT can inline the channel dispatch path.
- Non-cancelable, all-sync channels build a priority-ordered multicast dispatcher when subscriptions change.
- ShrinkPostResult stores Accepted/Handled/Canceled/Failure in one 32-bit value.
- Generic bus slots and handler snapshots are published with release semantics and read without a publish lock.
- Mixed sync/async channels, cancelable events, queued schedulers and PostAsync retain the full semantic path.
Results are local editor measurements, not cross-device guarantees. The supplied MessagePipe chart was
produced by a different runtime and machine; the class-payload comparison only establishes the same
order of throughput. Recheck on the target Player and hardware before release.