From: Heesob Park Date: 2009-01-10T08:36:56+09:00 Subject: Re: Pure Ruby Zlib::GzipWriter Hi, 2009/1/10 Daniel Berger : > Hi, > > On Jan 8, 8:23 pm, "Heesob Park" wrote: >> 2009/1/8 Daniel Berger : >> >> > On Jan 7, 11:08 pm, "Heesob Park" wrote: >> >> Hi, >> >> >> 2009/1/8 Charles L. :> Daniel Berger wrote: >> >> >> >> Sounds like you're on track. But, you're in a race with Park Heesob. :) >> >> >> >> Dan >> >> >> > Heh. :) Somehow I think he's got it covered. That reimplementation of >> >> > zlib in ruby is actually pretty cool. I'm curious Park, as to how much >> >> > you did by hand and how much you were able to automate it...? >> >> >> I dit it all by hand. There is no royal road to translating C to Ruby:) >> >> >> > I've put the deflate code i wrote on pastie -http://pastie.org/355367 >> >> > Excellent, thanks! >> >> >> > It's about 600 lines, but needs cleaning up. Will probably be ~500 when >> >> > I've added in dynamic trees and cleaned it up a bit. >> >> >> > Prelim benchmarks show the current bottleneck to be the LZ77 >> >> > implementation which is interesting. I think for it to perform >> >> > acceptably, a lot more of the code needs to become more idiomatic, >> >> > higher-level ruby. >> >> >> In my test, the deflation is very slow but the inflation is endurable. >> >> Moreover, for the compatibility of the various Ruby version, It shows >> >> bad performance in Ruby 1.8.x. >> >> > As long as it's usable I'm happy. We can benchmark, profile and >> > optimize later. :) >> >> Finally I translated the whole zlib.c to ruby code. >> You can download athttp://121.78.227.9/rbzlib/pzlib.rb > > Looks very promising but doesn't quite work yet: > > C:\>gem install ptools > ERROR: While executing gem ... (NoMethodError) > undefined method `ZSTREAM_IS_FINISHED' for # 0x2f8e8bc> > > I think you need some tests. ;) > > BTW, I'm assuming this is basically a wholesale replacement of zliby? > If so, the module should be renamed from PZlib to just Zlib. > Otherwise, Rubygems will complain about the lack of a Gem::Zlib > definition. > > Keep up the good work! > I fixed some typo and renamed PZlib to Zlib and pzlib.rb to zlib.rb I succeeded "gem install ptools" with zlib.rb You can download it at http://121.78.227.9/rbzlib/zlib.rb Regards, Park Heesob