My server's core plugin (plugin that manages most things on servers) uses a few event listeners in different areas, like one for anticheat, one for chat filter, etc.. I was wondering if more event listeners would make any noticeable difference in performance, or would it be the same as having one? I want to improve performance, but at the same time keep things organized.
More event listeners won't, but a lot (say around 50) would. Suppose all the 50 listeners listen to PlayerJoinEvent. PluginManager::callEvent() will have to loop through all the 50 methods, which would take at least the same time as executing a simple MySQL INSERT statement without optimizations. I've heard rumors that PHP 8 will have a new JIT engine, which could make loop execution time faster.
Ahh, that makes sense. I use like 6 or something like that. And PHP8???!?!?! Yeah hopefully it's a lot fucking faster than PHP 7.
If PHP 8 has a JIT engine, typehints and strict types would actually speed up code execution. I don't think PHP 8 will already have this included though, but I might be wrong!
You guys give PHP 7 way too much shit. I invite you all to just remember PHP 5, and also to remember that there are a bunch of things which affect PocketMine's performance other than PHP.
Also note that you can't have two event listeners in the same Listener class for the same event and priority.