Preallocate compression output buffer to remove unnecessary resizing

This commit is contained in:
md_5
2025-01-27 20:08:58 +11:00
parent 0aa2871b26
commit 60a3bf082f
3 changed files with 15 additions and 3 deletions

View File

@@ -52,7 +52,13 @@ public class NativeZlib implements BungeeZlib
while ( !nativeCompress.finished && ( compress || in.isReadable() ) )
{
out.ensureWritable( OUTPUT_BUFFER_SIZE );
if ( compress )
{
out.ensureWritable( OUTPUT_BUFFER_SIZE );
} else
{
Preconditions.checkArgument( out.isWritable(), "Output buffer overrun" );
}
int processed;
try