-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize stack #828
Optimize stack #828
Conversation
Can you explain why these changes are needed? |
As explained on Discord, the main benefits are reduced allocations, using newer and faster Java 11+ NIO APIs and improved error-handling. |
I'm working on a little extra stuff for this PR. We can heavily simplify the entire pipeline by switching to AttributeKeys for controlling encryption/compression from netty. That way we don't need to modify the pipeline after initialization. |
Nah, lets get merged first what is already here. I don't want the PR to get too big.But I roughly know how this should be implemented. Maybe I'll make it into another PR. |
This simplifies all pipeline code and ensures some listeners like the sizer are always present. The code already assumed that the sizer is always there and thus causes issues. The sizer can be deactivated still now and has pretty much no performance losses from this. The profit from this PR is that there is less logic with modifying the PR and thus developers interacting with the channel can assume specific things about the order and placements of elements in the pipeline. This will be useful once ViaVersion is supported, and it is expected that certain elements always are in the pipeline and don't change. My plan is to also always have an encryption and compression handler in the pipeline that is controlled via AttributeKeys from netty, but for that first GeyserMC#828 needs to be merged. So this PR only completes the goal partially, but that's fine. PR is ready for review like it is right now.
protocol/src/main/java/org/geysermc/mcprotocollib/network/compression/ZLIBCompression.java
Outdated
Show resolved
Hide resolved
Do you have some benchmarks of the before and after? |
Unfortunately I don't have the tooling right now to test this properly. |
protocol/src/main/java/org/geysermc/mcprotocollib/network/crypt/PacketEncryption.java
Show resolved
Hide resolved
protocol/src/main/java/org/geysermc/mcprotocollib/network/compression/ZlibCompression.java
Outdated
Show resolved
Hide resolved
protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpPacketCompression.java
Outdated
Show resolved
Hide resolved
protocol/src/main/java/org/geysermc/mcprotocollib/network/crypt/PacketEncryption.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* Improve pipeline This simplifies all pipeline code and ensures some listeners like the sizer are always present. The code already assumed that the sizer is always there and thus causes issues. The sizer can be deactivated still now and has pretty much no performance losses from this. The profit from this PR is that there is less logic with modifying the PR and thus developers interacting with the channel can assume specific things about the order and placements of elements in the pipeline. This will be useful once ViaVersion is supported, and it is expected that certain elements always are in the pipeline and don't change. My plan is to also always have an encryption and compression handler in the pipeline that is controlled via AttributeKeys from netty, but for that first #828 needs to be merged. So this PR only completes the goal partially, but that's fine. PR is ready for review like it is right now. * Revert some stuff * Fix channel race condition * Fix closing race condition * Prevent client race conditions. * Fix test failure, idk how, idk why, but it works now * Address review * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java Co-authored-by: Konicai <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java Co-authored-by: Konicai <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java Co-authored-by: chris <[email protected]> * Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java Co-authored-by: chris <[email protected]> --------- Co-authored-by: Konicai <[email protected]> Co-authored-by: chris <[email protected]>
No description provided.