The Source for Java Technology Collaboration

Home » java.net Forums » Performance » General Performance Discussion

Thread: DeflaterOutputStream vs. pure Java implementations?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: Jun 5, 2007 9:08 AM by: linuxhippy Threads: [ Previous | Next ]
linuxhippy

Posts: 646
DeflaterOutputStream vs. pure Java implementations?
Posted: Jun 3, 2007 2:21 PM
  Click to reply to this thread Reply

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

christian_schli...

Posts: 13
Re: DeflaterOutputStream vs. pure Java implementations?
Posted: Jun 4, 2007 6:40 AM   in response to: linuxhippy
  Click to reply to this thread Reply

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

Posts: 646
Re: DeflaterOutputStream vs. pure Java implementations?
Posted: Jun 5, 2007 9:08 AM   in response to: christian_schli...
  Click to reply to this thread Reply

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




 XML java.net RSS