Skip to main content

DeflaterOutputStream vs. pure Java implementations?

2 replies [Last post]
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Hello,

I am currently developing a client-server framework and I am thinking about compressing all Input/Output using DeflaterInput/OutputStream. I am a bit concerned about the native nature of Deflater/Inflater - and several performance related bug-reports surrounding it.
Netbeans profiler also points to Inflater/Deflater as beeing a bottleneck, however I don't trust it given the fact I only compress about 200kB, the java-code generating those 200kb is quite complex and I only use default-compression.

Have you used Deflater/Inflater or their wrapper-streams successfully in high-load, high-scale enterprise applications, or would you recommend using a pure-java implementations of a compression algorythm? How does it affect scalability? Does it use highly optimized native code - or would pure java implementations be almost as fast?

Thank you in advance, lg Clemens

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
christian_schli...
Offline
Joined: 2005-05-21
Points: 0

A little more than two years ago, I started to write https://truezip.dev.java.net. When looking at java.util.zip.* I realized I needed a custom version of this package.

I then looked at GNU ClassPath (0.97 I think it was at the time). GNU ClassPath comes with a 100% Java implementation of the Inflater/Deflater classes. I integrated it into my code and ran my unit tests. Surprise, surprise, but the all-Java implementation was orders slower. The factor is actually hard to tell because it heavily depends on the data and the compression level.

After all I changed my code to use java.util.Inflater/Deflater again. It's robust, it's fast and it really shouldn't matter that it's native code since it's in the JRE.

Kind regards,
Christian

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Thanks for sharing your experiences :-)
Well, then ... until problems pop up I'll use DeflaterOutputStream/InflaterInpuStream in future too.

Thanks for you suggestions and good luck with your project, lg Clemens