ZeroMemes / Alpine

A lightweight event system for Java 8+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Event to Listener Maps

ZeroMemes opened this issue · comments

There's no way to control the underlying implementation of EventManager.activeListeners.

The current implementation in 3.0.0 is backed by a Reference2ObjectOpenHashMap, which is allowed to infinitely grow. However, some applications may use an EventBus which has a fixed amount of known event types (Baritone 👀). In such a case, a perfect hashing function could be used for optimized lookup.

I'll need to do some research into automatically generating perfect hash functions, and a lot of benchmarking to see if/when something like this can actually have a statistically significant performance benefit.