dmulloy2 / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
982 stars 259 forks source link

Inefficient Async Packet Processing Sequence #3028

Open Ingrim4 opened 1 week ago

Ingrim4 commented 1 week ago

When a packet is intercepted, it is first processed by all sync packet listeners and then by async ones. The AsyncMarker is used to send the packets once they have been processed by all async packet listeners. After this, the process jumps back to the main thread to invoke MONITOR listeners, which might not even exist. This seems inefficient since the sync monitor listeners have already been invoked and do not require invocation again. To improve efficiency, I propose changing this behavior to always notify the injector directly once a packet is done processing.

Should improve/solve #2549