Closed AlexProgrammerDE closed 2 months ago
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.
Do you have some benchmarks of the before and after?
Do you have some benchmarks of the before and after?
Unfortunately I don't have the tooling right now to test this properly. But I can tell you about why this is faster. For compression/decompression now nio buffers are used. That reduces the array allocations and works more closely with the deflater/inflater classes. That way operations are slightly faster. For encryption the same methods are used, but it's faster because of removal of unnecessary array size allocations. With the encryption algorithm used in mc the in and out size of the algorithm is the same and thus no extra arrays need to be allocated, we can simply just reuse the input buffer.
Can you explain why these changes are needed?