Performance regression in java.util.zip.Deflater

Alan Bateman Alan.Bateman at Sun.COM
Mon Jan 7 08:35:36 UTC 2008


Clemens Eisserer wrote:
> :
>
> PS: The striding+GetPrimitive... is even used by NIO for copying
> java-arrays into direct-ByteBuffers:
>     while (length > 0) {
> 	size = (length > MBYTE ? MBYTE : length);
> 	GETCRITICAL(bytes, env, dst);
>  	memcpy(bytes + dstPos, (void *)srcAddr, size);
> 	RELEASECRITICAL(bytes, env, dst, 0);
>     ................
>   
Yes, NIO uses JNI critical sections when copying to/from arrays, but as 
a FYI, we hope to eliminate this native code soon. The replacement uses 
the Unsafe interface to do the copying and will be much faster than the 
current native implementation. To allow for safepoint polling (in the 
VM) it also copies very large arrays/buffers in strides.

-Alan.




More information about the core-libs-dev mailing list