Permalink
Browse files

Backport new zlib impl with JZlib

Just for performance comparison with old implementation.
  • Loading branch information...
nahi committed Oct 11, 2011
1 parent 78a5fa7 commit 3bcb9ad17fad12561f2143f71d0f1c1199f308a6
View
@@ -38,5 +38,6 @@
<classpathentry kind="lib" path="build_lib/jnr-netdb.jar"/>
<classpathentry kind="lib" path="build_lib/org.osgi.core-4.2.0.jar"/>
<classpathentry kind="lib" path="build_lib/snakeyaml-1.9.jar"/>
+ <classpathentry kind="lib" path="build_lib/jzlib-1.1.0.jar"/>
<classpathentry kind="output" path="build.eclipse"/>
</classpath>
View
@@ -0,0 +1,62 @@
+require 'benchmark'
+require 'zlib'
+require 'stringio'
+
+FILES = Dir.glob(File.expand_path('*.rb', File.dirname(__FILE__)))
+
+Benchmark.bmbm do |bm|
+ bm.report('Zlib::Deflate') do
+ z = Zlib::Deflate.new
+ 300.times do
+ FILES.each do |file|
+ z << File.read(file)
+ end
+ z.flush
+ end
+ z.finish
+ end
+
+ bm.report('Zlib::Inflate') do
+ # prepare
+ z = Zlib::Deflate.new
+ FILES.each do |file|
+ z << File.read(file)
+ end
+ src = z.finish
+
+ 3000.times do
+ z = Zlib::Inflate.new
+ z << src
+ z.finish
+ end
+ end
+
+ bm.report('Zlib::GzipWriter') do
+ s = StringIO.new
+ Zlib::GzipWriter.wrap(s) do |gz|
+ 300.times do
+ FILES.each do |file|
+ gz.write File.read(file)
+ end
+ s.truncate(0)
+ end
+ end
+ end
+
+ bm.report('Zlib::GzipReader') do
+ # prepare
+ s = StringIO.new
+ Zlib::GzipWriter.wrap(s) do |gz|
+ FILES.each do |file|
+ gz.write File.read(file)
+ end
+ end
+ src = s.string
+
+ 3000.times do
+ Zlib::GzipReader.wrap(StringIO.new(src)) do |gz|
+ gz.read
+ end
+ end
+ end
+end
View
@@ -369,6 +369,7 @@
<zipfileset src="${build.lib.dir}/yecht.jar"/>
<zipfileset src="${build.lib.dir}/yydebug.jar"/>
<zipfileset src="${build.lib.dir}/nailgun-0.7.1.jar"/>
+ <zipfileset src="${build.lib.dir}/jzlib-1.1.0.jar"/>
<metainf dir="spi">
<include name="services/**"/>
</metainf>
@@ -469,6 +470,7 @@
<zipfileset src="${build.lib.dir}/yecht.jar"/>
<zipfileset src="${build.lib.dir}/yydebug.jar"/>
<zipfileset src="${build.lib.dir}/nailgun-0.7.1.jar"/>
+ <zipfileset src="${build.lib.dir}/jzlib-1.1.0.jar"/>
<metainf dir="spi">
<include name="services/**"/>
</metainf>
@@ -627,6 +629,7 @@
<zipfileset src="${build.lib.dir}/yecht.jar"/>
<zipfileset src="${build.lib.dir}/yydebug.jar"/>
<zipfileset src="${build.lib.dir}/nailgun-0.7.1.jar"/>
+ <zipfileset src="${build.lib.dir}/jzlib-1.1.0.jar"/>
<metainf dir="spi">
<include name="services/**"/>
</metainf>
View
Binary file not shown.
@@ -1 +0,0 @@
-fails(JRUBY-3775):Zlib::Deflate#params changes the deflate parameters
@@ -0,0 +1 @@
+fails:Zlib::GzipWriter#mtime= raises if the header was written
@@ -0,0 +1 @@
+fails:Zlib::GzipWriter#mtime= raises if the header was written
Oops, something went wrong.

0 comments on commit 3bcb9ad

Please sign in to comment.