This PR contains a few well-separated commits, so here is an explanation for each of them:
Improve no-ASM event performance
Rewrite LockHelper to have lock-free reads.
Try allocation-free get before passing an allocating lambda to computeIfAbsent.
Remove unneeded isCancelable calls - they are a bit slow due to the global map lookup.
Benchmark results
Note that this should not affect the ASM-based numbers, so only the ratio between ClassLoader/ModLauncher and NoLoader should be compared, not the absolute numbers.
Based on these results, I removed the ClassLoader and ModLauncher factories.
Store listener list in a hashmap in the EventBus
Basically, we need an identityhashmap lookup, but we have one less indirection due to not having to get the listener list for the bus id. So the performance seems equivalent, and I thus removed all the ASM stuff.
This PR contains a few well-separated commits, so here is an explanation for each of them:
Improve no-ASM event performance
LockHelper
to have lock-free reads.get
before passing an allocating lambda tocomputeIfAbsent
.isCancelable
calls - they are a bit slow due to the global map lookup.Benchmark results
Note that this should not affect the ASM-based numbers, so only the ratio between
ClassLoader/ModLauncher
andNoLoader
should be compared, not the absolute numbers.Before
After
Use LambdaMetaFactory to invoke reflected event handlers
This approach is considerably simpler, and has similar performance to the ASM-based approaches. Sadly we need the
IMPL_LOOKUP
... :smile:Benchmark
Based on these results, I removed the ClassLoader and ModLauncher factories.
Store listener list in a hashmap in the
EventBus
Basically, we need an identityhashmap lookup, but we have one less indirection due to not having to get the listener list for the bus id. So the performance seems equivalent, and I thus removed all the ASM stuff.
Benchmark of the new approach (IdentityHashMap)