Compression is heavily used in Java based big data, genomics and middleware applications. There are many products in market today which help in compression performance either through software or hardware acceleration. Intel has faster compression libraries as part of IPP and also there are hardware compression accelerator products from Intel. Both of these products are available in the market today and support the zlib interface as an API. Support in the JVM to use system zlib on a JVM command line option would make these acceleration capabilities available to Linux java users through java.util.zip.
The JVM could support this on an option UseSystemZlib which can be set to false by default. When the option is set to true on command line by the user, the load_zip_library() function in classLoader.cpp can load libszip.so instead of libzip.so. Also the JVM can set the java.util.zip.UseSystemZlib property accordingly.
The JDK would need to include two libraries for zip in jre/lib/amd64: libzip.so and libszip.so. The libzip.so will be built as before with statically linking system zlib with it and libszip.so will be built without statically linking system zlib with it. Also the java.lang.System.initializeSystemClass will load libzip.so or libszip.so based on the java.util.zip.UseSystemZlib property.
The users can then use system zlib by including the -XX:+UseSystemZlib option on the command line and compression accelerators by setting the LD_LIBRARY_PATH and LD_PRELOAD appropriately.