Optimize native handling further.
We now try to work within the boundaries given by the native. In the case of Java natives, we work with byte arrays. With natives, always use direct buffers. However, the numbers do favor the natives, since they work with direct byte buffers, without any copying. For the most part, this commit is intended to improve the lives of Velocity users on Windows.
This commit is contained in:
@@ -85,7 +85,7 @@ Java_com_velocitypowered_natives_compression_NativeZlibDeflate_process(JNIEnv *e
|
||||
jint sourceLength,
|
||||
jlong destinationAddress,
|
||||
jint destinationLength,
|
||||
jboolean flush)
|
||||
jboolean finish)
|
||||
{
|
||||
z_stream* stream = (z_stream*) ctx;
|
||||
stream->next_in = (Bytef *) sourceAddress;
|
||||
@@ -93,7 +93,7 @@ Java_com_velocitypowered_natives_compression_NativeZlibDeflate_process(JNIEnv *e
|
||||
stream->avail_in = sourceLength;
|
||||
stream->avail_out = destinationLength;
|
||||
|
||||
int res = deflate(stream, flush ? Z_FINISH : Z_NO_FLUSH);
|
||||
int res = deflate(stream, finish ? Z_FINISH : Z_NO_FLUSH);
|
||||
switch (res) {
|
||||
case Z_STREAM_END:
|
||||
// The stream has ended.
|
||||
|
Reference in New Issue
Block a user