# Pure Ruby Zlib::GzipWriter

**URL:** <https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694>\
**Category:** Ruby\
**Created:** [December 15, 2008, 5:40pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694 "2008-12-15T17:40:08Z")\
**Posts on this page:** 13\
**Page:** 3

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 10, 2009, 8:50pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/41 "2009-01-10T20:50:53Z")

</div>

On Jan 10, 4:21 pm, Michal S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I guess it’s expected. Different implementations give different  
> compression results.

The failures are related to wrong number of arguments.

if a replacement for Zlib is developed, it must comply with Zlib specs  
located in rubyspec:

[http://github.com/rubyspec/rubyspec/tree/b83d7e5f40659f551c7e94667ffeeb0ea7c6bcfe/library/zlib](http://github.com/rubyspec/rubyspec/tree/b83d7e5f40659f551c7e94667ffeeb0ea7c6bcfe/library/zlib)

It should implement the exact same compression strategies. If not, is  
not a “drop-in” replacement.

> Of course, the spec might be more high-level but then an  
> implementation that does not compress at all would likely work as  
> well.

The spec is being used across IronRuby, Rubinius, JRuby and the Ruby C  
(MRI). So the pure-ruby replacement must comply.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 11, 2009, 2:46pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/42 "2009-01-11T14:46:05Z")

</div>

On Jan 9, 5:34 pm, Luis L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Jan 9, 9:26 pm, “Charles L.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Anyone knows any web application for bounties? I’m interested in  
> contribute to this one and also one for Readline!!!

I think that’s a fantastic idea Luis!

I can live without a pure Ruby readline (though I’d certainly welcome  
it). I’d rather have a pure Ruby OpenSSL. 🙂

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 11, 2009, 4:32pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/43 "2009-01-11T16:32:26Z")

</div>

On 01/11/2009, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I can live without a pure Ruby readline (though I’d certainly welcome  
> it). I’d rather have a pure Ruby OpenSSL. 🙂

What parts of OpenSSL? 😉

J.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 11, 2009, 2:44pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/44 "2009-01-11T14:44:20Z")

</div>

On Jan 11, 5:25 am, “Heesob P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > > > > On Jan 10, 8:15 am, Heesob P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > > > > 
> > > > > > > I guess you are looking for ruby\_readline [1] .  
> > > > > > > ReadLine.
> 
> > [http://github.com/rubyspec/rubyspec/tree/b83d7e5f40659f551c7e94667ffe](http://github.com/rubyspec/rubyspec/tree/b83d7e5f40659f551c7e94667ffe)…
> 
> At last, my zlib.rb and rbzlib.rb passed rubyspec zlib test  
> As before, you can download athttp://121.78.227.9/rbzlib/
> 
> Finished in 1.323951 seconds
> 
> 77 files, 38 examples, 88 expectations, 0 failures, 0 errors

Good work. I just tried it out. Both reading and writing seemed to  
work fine. Generating a gem for my largest project, windows-pr, worked  
fine as well.

Awesome!!!

Announcement forthcoming…

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 12, 2009, 3:39pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/45 "2009-01-12T15:39:50Z")

</div>

On Dec 15 2008, 9:32 am, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> must meet the following criteria:
> 
> - It must be pure Ruby. No extensions. No FFI.
> - It must have tests (and pass them)
> - It must match the current Zlib::GzipWriter interface
> - It must be cross platform
> - It must be able to generate a proper gem file from a gemspec (the  
> acid test)
> - It must be contributed back to the zliby project
> - It must be done within 60 days of this post

And the winner is…Park H.! We actually had two competitors for  
the bounty (much to my surprise), and it was very close (again, to my  
surprise), but in the end Park’s code passed an acid test that  
Charles’ code did not.[1]

So, congratulations to Park H. for not only creating a  
Zlib::GzipWriter implementation, but for also creating a pure Ruby  
version of the underlying zlib 1.2.3 library!

WOOHOO!

Regards,

Dan

[1] However, I hate to see Charles go unrewarded for his wonderful  
efforts, so any matchers are free to distribute their bounties as they  
see fit.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 11, 2009, 6:54pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/46 "2009-01-11T18:54:05Z")

</div>

On Fri, Jan 9, 2009 at 6:23 PM, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Ok, I’ll look for it and just copy/paste files individually when  
> you’re ready.  
> Hopefully that is not necessary  
> wget [http://github.com/aquasync/ruby-zlib/tarball/master](http://github.com/aquasync/ruby-zlib/tarball/master)  
> seems to work just fine.  
> HTH  
> Robert

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 12, 2009, 5:17pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/47 "2009-01-12T17:17:52Z")

</div>

Daniel B. wrote:

> On Dec 15 2008, 9:32ï¿½am, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> So, congratulationns to Park H. for not only creating a  
> Zlib::GzipWriter implementation, but for also creating a pure Ruby  
> version of the underlying zlib 1.2.3 library!
> 
> WOOHOO!
> 
> Regards,
> 
> Dan
> 
> [1] However, I hate to see Charles go unrewarded for his wonderful  
> efforts, so any matchers are free to distribute their bounties as they  
> see fit.

This is just awesome, thanks Dan for putting up some cash to make this  
happen! Compression was more difficult then decompression and I just  
didn’t have the time. Going to look into combining Park’s code into  
zliby.. though Charles stuff looks interesting too…

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 13, 2009, 1:30am UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/48 "2009-01-13T01:30:51Z")

</div>

On Jan 12, 12:38 pm, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > acid test)  
> > So, congratulations to Park H. for not only creating a  
> > efforts, so any matchers are free to distribute their bounties as they  
> > see fit.

I have some bucks with Park and Charles names printed on them 😉

Park: I have your Paypal info, will send you as soon as possible.

Charles: can you tell me your paypal email?

Again: do anyone knows a good platform to to bounties for open source  
projects?

Regards,

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 13, 2009, 5:55am UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/49 "2009-01-13T05:55:13Z")

</div>

Jano S. wrote:

> On 01/11/2009, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I can live without a pure Ruby readline (though I’d certainly welcome  
> > it). I’d rather have a pure Ruby OpenSSL. 🙂
> 
> What parts of OpenSSL? 😉

Just the parts that Ruby’s openssl wrapper uses.

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 13, 2009, 2:51am UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/50 "2009-01-13T02:51:33Z")

</div>

Luis L. wrote:

> I have some bucks with Park and Charles names printed on them 😉
> 
> Park: I have your Paypal info, will send you as soon as possible.
> 
> Charles: can you tell me your paypal email?
> 
> Again: do anyone knows a good platform to to bounties for open source  
> projects?
> 
> Regards,

Thanks Luis, but never mind, it was more about the challenge, and also  
supporting the effort to ease problems on windows. I primarily use ruby  
on windows, and make use of the fruits of your (one click installer),  
and daniel berger’s (win32 process, sys-\*, et al) labors every day (at  
work that is :). Props to you guys for making ruby on windows useable…

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 13, 2009, 9:06pm UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/51 "2009-01-13T21:06:21Z")

</div>

Charles L. wrote:

> Luis L. wrote:
> 
> > I have some bucks with Park and Charles names printed on them 😉
> > 
> > Park: I have your Paypal info, will send you as soon as possible.
> > 
> > Charles: can you tell me your paypal email?
> > 
> > Again: do anyone knows a good platform to to bounties for open source  
> > projects?
> > 
> > Regards,
> 
> Thanks Luis, but never mind, it was more about the challenge, and also  
> supporting the effort to ease problems on windows. I primarily use ruby  
> on windows, and make use of the fruits of your (one click installer),  
> and daniel berger’s (win32 process, sys-\*, et al) labors every day (at  
> work that is :). Props to you guys for making ruby on windows useable…

Charles,

I like how you laid out your project and whatnot. My “dream” is to make  
zliby more then just a zlib compression library, but a more general  
compression library and command line tool. Your compression code seems  
to be more in the same style as my decompression implementation, any  
qualms against me incorporating some of your stuff?

I also added Park to the zliby ruby-forge project, if you’d like I can  
add you as well, or add you as a collaborator on the zliby github  
project.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 17, 2009, 2:19am UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/52 "2009-01-17T02:19:15Z")

</div>

Charles L. wrote:

> > add you as well, or add you as a collaborator on the zliby github  
> > and a pure ruby zlib, all thats probably missing is bzip2, and bwt is  
> > fairly straight forward (I believe I saw a python implementation in  
> > around 100 lines).
> 
> I’m really hoping some of that javascript vm goodness will find its way  
> to ruby though (or psyco equivalent or whatever), because without it,  
> pure ruby compression (or any algorithmic code) remains unsuitable for  
> general purpose use.

I didn’t notice much of a slowdown with Park’s version when installing  
gems or building gems, though I didn’t do any sort of formal  
benchmarking.

It would be interesting to see some real benchmarks with MRI, JRuby and  
1.9.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [January 16, 2009, 7:46am UTC](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694/53 "2009-01-16T07:46:27Z")

</div>

Michael L. wrote:

> Charles,
> 
> I like how you laid out your project and whatnot. My “dream” is to make  
> zliby more then just a zlib compression library, but a more general  
> compression library and command line tool. Your compression code seems  
> to be more in the same style as my decompression implementation, any  
> qualms against me incorporating some of your stuff?
> 
> I also added Park to the zliby ruby-forge project, if you’d like I can  
> add you as well, or add you as a collaborator on the zliby github  
> project.

Hi Michael,

Sure feel free to add me on the rubyforge/github, or just copy the  
relevant files back in if you prefer. There’s a few small fixes needed  
to the deflate code, but after that it might be a good candidate for  
inclusion.

The idea of a general ruby compression library is nice. With rubyzip,  
and a pure ruby zlib, all thats probably missing is bzip2, and bwt is  
fairly straight forward (I believe I saw a python implementation in  
around 100 lines).

I’m really hoping some of that javascript vm goodness will find its way  
to ruby though (or psyco equivalent or whatever), because without it,  
pure ruby compression (or any algorithmic code) remains unsuitable for  
general purpose use.

[Previous page](https://www.ruby-forum.com/t/pure-ruby-zlib-gzipwriter/155694.md?page=2)
