[BOUNTY] Pure Ruby Zlib::GzipWriter

Hi,

If we had a pure Ruby version available as a gem on the other hand...

:slight_smile:

I finished translation and testing of the pure ruby version.
The ruby version is exact same api interface and functionality with
the zlib c source code.
It is also compatible with ruby 1.8.x and 1.9.x and includes
examble.rb and minizip.rb for testing.

You can download at http://121.78.227.9/rbzlib/

I am working on translation of ruby library zlib.c to pure ruby code.

Regards,

Park Heesob

ยทยทยท

2009/1/6 Daniel Berger <djberg96@gmail.com>:

Charles L. wrote:

Luis Lavena wrote:

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

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.

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Heesob Park wrote:

Hi,

If we had a pure Ruby version available as a gem on the other hand...

:slight_smile:

I finished translation and testing of the pure ruby version.
The ruby version is exact same api interface and functionality with
the zlib c source code.
It is also compatible with ruby 1.8.x and 1.9.x and includes
examble.rb and minizip.rb for testing.

You can download at http://121.78.227.9/rbzlib/

Awesome!

I am working on translation of ruby library zlib.c to pure ruby code.

Looks like you and Charles L. are in a race. :slight_smile:

Regards,

Dan

ยทยทยท

2009/1/6 Daniel Berger <djberg96@gmail.com>:

Charles L. wrote:

Daniel Berger wrote:

If we had a pure Ruby version available as a gem on the other hand...

:slight_smile:

Regards,

Dan

I'm most of the way done, just missing dynamic huffman trees, and more interface similarity with zlib. Need to change the specs from zliby though as the algorithm I'm using is not identical to zlib and gives different (but still valid) results.

For example, zlib's lz77 phase doesn't seem to behave optimally wrt repeats:

Zlib::Deflate.deflate(0.chr * 10, 9).length

=> 10

CZlib::Deflate.deflate(0.chr * 10, 9).length

=> 11

CZlib::Inflate.inflate(Zlib::Deflate.deflate(0.chr * 10, 9)) == 0.chr * 10

=> true

CZlib::Inflate.inflate(CZlib::Deflate.deflate(0.chr * 10, 9)) == 0.chr * 10

=> true

(using CZlib for inflation there as I've not integrated it with the zliby code yet).

Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

Dan

Michael Letterle 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.

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Daniel Berger wrote:

Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

Dan

Heh. :slight_smile: 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've put the deflate code i wrote on pastie - http://pastie.org/355367

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.
--
Posted via http://www.ruby-forum.com/\.

I am working on translation of ruby library zlib.c to pure ruby code.

Looks like you and Charles L. are in a race. :slight_smile:

Maybe you can collaborate? :slight_smile:
Let us know when somebody think it's about done :slight_smile:

-=r

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Charles L. wrote:

Michael Letterle 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.

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

Hi,

Daniel Berger wrote:

Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

Dan

Heh. :slight_smile: 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:)

ยทยทยท

2009/1/8 Charles L. <aquasync@gmail.com>:

I've put the deflate code i wrote on pastie - http://pastie.org/355367

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.

Regards,

Park Heesob

Roger Pack wrote:

Maybe you can collaborate? :slight_smile:
Let us know when somebody think it's about done :slight_smile:

-=r

I'm not sure there's much room for collaboration at the Zlib wrapper &
below level, but perhaps the GzipFile and upwards (ie Reader/Writer)
implementations can be shared.

The big thing is just good specs, and the existing rubyspec ones could
use some work which will benefit all of us.

I've added most of the remaining missing functionality to my version (ie
dynamic huffman tree's etc), and added back in the inflate functionality
from zliby, and put the result up on github -

I've since added enough of the GzipWriter & GzipFile functionality that
the existing specs all pass (see below. note the GzipFile specs use
GzipWriter). Unable to push this last commit to github presently, but
will try later.

It is likely complete enough for the purposes of creating rubygems, but
is still missing functionality, which needs specing out (Eg wtf is
Zlib::GzipWriter.wrap, Zlib::GzipWriter reimplements a lot of IO
functions like puts, etc).

Zlib::Deflate#set_dictionary
- sets the dictionary

Zlib::Deflate#deflate
- deflates some data

Zlib::Deflate::deflate
- deflates some data

Zlib::GzipFile#closed?
- returns the closed status

Zlib::GzipFile#close
- finishes the stream and closes the io

Zlib::GzipFile#comment
- returns the name
- raises an error on a closed stream

Zlib::GzipFile#orig_name
- returns the name
- raises an error on a closed stream

Zlib::GzipWriter#mtime=
- sets mtime using Integer
- sets mtime using Time
- raises if the header was written

GzipWriter#write
- writes some compressed data

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Hi,

>> Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

>> Dan

> Heh. :slight_smile: 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:)

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. :slight_smile:

regards,

Dan

ยทยทยท

On Jan 7, 11:08 pm, "Heesob Park" <pha...@gmail.com> wrote:

2009/1/8 Charles L. <aquas...@gmail.com>:> Daniel Berger wrote:
> I've put the deflate code i wrote on pastie -http://pastie.org/355367

Roger Pack wrote:

> Maybe you can collaborate? :slight_smile:
> Let us know when somebody think it's about done :slight_smile:

> -=r

I'm not sure there's much room for collaboration at the Zlib wrapper &
below level, but perhaps the GzipFile and upwards (ie Reader/Writer)
implementations can be shared.

The big thing is just good specs, and the existing rubyspec ones could
use some work which will benefit all of us.

Agreed.

I've added most of the remaining missing functionality to my version (ie
dynamic huffman tree's etc), and added back in the inflate functionality
from zliby, and put the result up on github -GitHub - aquasync/ruby-zlib: Pure ruby zlib implementation

Thanks. Unfortunately, I cannot download it. IE7 and FF3 simply do
nothing when I click on the download link. FF2 (before I upgraded)
gave me a "file not found" error.

This actually happens to me a lot with github, on not just on Windows.

I've since added enough of the GzipWriter & GzipFile functionality that
the existing specs all pass (see below. note the GzipFile specs use
GzipWriter). Unable to push this last commit to github presently, but
will try later.

Ok, I'll look for it and just copy/paste files individually when
you're ready.

Regards,

Dan

ยทยทยท

On Jan 8, 6:56 pm, "Charles L." <aquas...@gmail.com> wrote:

<snip>

Ok, I was able to download the project and I ran the specs:

C:\ruby\src\ruby-zlib>spec specs
.............FF.......................

1)
'Zlib::Deflate#params changes the deflate parameters' FAILED
expected: "x\001\000\v\000\364\377abcdefghijk\002,'\027\000#
\364\005<",
     got: "x\234KLJNIMK\317\310\314\312\316\311\005\000#
\364\005<" (using ==)
C:/ruby/src/ruby-zlib/specs/deflate/params_spec.rb:16

2)
NameError in 'Zlib::Deflate#set_dictionary sets the dictionary'
uninitialized constant Zlib::Deflate
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:6
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5:in `each'
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5

Finished in 1.688 seconds

38 examples, 2 failures

Ruby 1.8.6-p114 built with VC++ 8
Windows XP Pro
RSpec 1.1.11

Regards,

Dan

ยทยทยท

On Jan 8, 6:56 pm, "Charles L." <aquas...@gmail.com> wrote:

Roger Pack wrote:

> Maybe you can collaborate? :slight_smile:
> Let us know when somebody think it's about done :slight_smile:

> -=r

I'm not sure there's much room for collaboration at the Zlib wrapper &
below level, but perhaps the GzipFile and upwards (ie Reader/Writer)
implementations can be shared.

The big thing is just good specs, and the existing rubyspec ones could
use some work which will benefit all of us.

I've added most of the remaining missing functionality to my version (ie
dynamic huffman tree's etc), and added back in the inflate functionality
from zliby, and put the result up on github -GitHub - aquasync/ruby-zlib: Pure ruby zlib implementation

Finally I translated the whole zlib.c to ruby code.
You can download at http://121.78.227.9/rbzlib/pzlib.rb

Regards,

Park Heesob

ยทยทยท

2009/1/8 Daniel Berger <djberg96@gmail.com>:

On Jan 7, 11:08 pm, "Heesob Park" <pha...@gmail.com> wrote:

Hi,

2009/1/8 Charles L. <aquas...@gmail.com>:> Daniel Berger wrote:

>> Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

>> Dan

> Heh. :slight_smile: 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. :slight_smile:

Daniel Berger wrote:

Ok, I was able to download the project and I ran the specs:

C:\ruby\src\ruby-zlib>spec specs
.............FF.......................

1)
'Zlib::Deflate#params changes the deflate parameters' FAILED
expected: "x\001\000\v\000\364\377abcdefghijk\002,'\027\000#
\364\005<",
     got: "x\234KLJNIMK\317\310\314\312\316\311\005\000#
\364\005<" (using ==)
C:/ruby/src/ruby-zlib/specs/deflate/params_spec.rb:16

2)
NameError in 'Zlib::Deflate#set_dictionary sets the dictionary'
uninitialized constant Zlib::Deflate
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:6
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5:in `each'
C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5

Finished in 1.688 seconds

38 examples, 2 failures

Ruby 1.8.6-p114 built with VC++ 8
Windows XP Pro
RSpec 1.1.11

Regards,

Dan

Yeah the github download functionality seems broken for me most of the
time also... :confused:

Anyway, the params failure is the only failure I get. Thats because I've
not implemented the NO_COMPRESSION mode yet, and is an easy fix. The
other error you're getting is odd, as Zlib::Deflate is defined, and if
it weren't none of the other deflate specs would have passed!

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

<snip>

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
seems to work just fine.
HTH
Robert

ยทยทยท

On Fri, Jan 9, 2009 at 6:23 PM, Daniel Berger <djberg96@gmail.com> wrote:
--
It is change, continuing change, inevitable change, that is the
dominant factor in society today. No sensible decision can be made any
longer without taking into account not only the world as it is, but
the world as it will be ... ~ Isaac Asimov

Hi,

>> Hi,

>> >> Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

>> >> Dan

>> > Heh. :slight_smile: 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:)

> 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. :slight_smile:

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 #<Zlib::GzipReader:
0x2f8e8bc>

I think you need some tests. :wink:

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!

Regards,

Dan

ยทยทยท

On Jan 8, 8:23 pm, "Heesob Park" <pha...@gmail.com> wrote:

2009/1/8 Daniel Berger <djber...@gmail.com>:
> On Jan 7, 11:08 pm, "Heesob Park" <pha...@gmail.com> wrote:
>> 2009/1/8 Charles L. <aquas...@gmail.com>:> Daniel Berger wrote:
>> > I've put the deflate code i wrote on pastie -http://pastie.org/355367

The work-in-progress of One-Click Installer:

Luis@KEORE (D:\Users\Luis\projects\oss\ruby-zlib.git)
$ spec specs
.............F........................

1)
'Zlib::Deflate#params changes the deflate parameters' FAILED
expected: "x\001\000\v\000\364\377abcdefghijk\002,'\027\000#
\364\005<",
     got: "x\234KLJNIMK\317\310\314\312\316\311\005\000#
\364\005<" (using ==)
D:/Users/Luis/projects/oss/ruby-zlib.git/specs/deflate/params_spec.rb:
16

Finished in 1.219 seconds

38 examples, 1 failure

Luis@KEORE (D:\Users\Luis\projects\oss\ruby-zlib.git)
$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32]

Luis@KEORE (D:\Users\Luis\projects\oss\ruby-zlib.git)
$ spec --version
rspec 1.1.11.6

Not bad, really not bad!

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

Regards,

ยทยทยท

On Jan 9, 9:26 pm, "Charles L." <aquas...@gmail.com> wrote:

Daniel Berger wrote:
> Ok, I was able to download the project and I ran the specs:

> C:\ruby\src\ruby-zlib>spec specs
> .............FF.......................

> 1)
> 'Zlib::Deflate#params changes the deflate parameters' FAILED
> expected: "x\001\000\v\000\364\377abcdefghijk\002,'\027\000#
> \364\005<",
> got: "x\234KLJNIMK\317\310\314\312\316\311\005\000#
> \364\005<" (using ==)
> C:/ruby/src/ruby-zlib/specs/deflate/params_spec.rb:16

> 2)
> NameError in 'Zlib::Deflate#set_dictionary sets the dictionary'
> uninitialized constant Zlib::Deflate
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:6
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5:in `each'
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5

> Finished in 1.688 seconds

> 38 examples, 2 failures

> Ruby 1.8.6-p114 built with VC++ 8
> Windows XP Pro
> RSpec 1.1.11

> Regards,

> Dan

Yeah the github download functionality seems broken for me most of the
time also... :confused:

Anyway, the params failure is the only failure I get. Thats because I've
not implemented the NO_COMPRESSION mode yet, and is an easy fix. The
other error you're getting is odd, as Zlib::Deflate is defined, and if
it weren't none of the other deflate specs would have passed!
--
Posted viahttp://www.ruby-forum.com/.

--
Luis Lavena

Ok, I tried again. Reading seemed to work fine. For writing it worked
fine for small libs, but when I tried it against my largest project,
windows-pr, I got this:

C:\Documents and Settings\djberge\workspace\windows-pr>ruby windows-
pr.gemspec
C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:859:in `log': Result
too large - log (Errno::ERANGE)
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:859:in
`log2'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:901:in
`chooseblock'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:882:in
`times'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:882:in
`chooseblock'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:613:in
`outsym'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:575:in
`match'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:430:in
`lz77_compress'
        from C:/ruby/lib/ruby/site_ruby/1.8/zlib/deflate.rb:490:in
`deflate'
         ... 10 levels...
        from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/builder.rb:68:in
`open'
        from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/builder.rb:68:in
`write_package'
        from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/builder.rb:37:in
`build'
        from windows-pr.gemspec:25

It's about 60 files. If you'd like to try windows-pr yourself you can
grab it via:

cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/win32utils login

cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/win32utils checkout

Regards,

Dan

ยทยทยท

On Jan 9, 4:26 pm, "Charles L." <aquas...@gmail.com> wrote:

Daniel Berger wrote:
> Ok, I was able to download the project and I ran the specs:

> C:\ruby\src\ruby-zlib>spec specs
> .............FF.......................

> 1)
> 'Zlib::Deflate#params changes the deflate parameters' FAILED
> expected: "x\001\000\v\000\364\377abcdefghijk\002,'\027\000#
> \364\005<",
> got: "x\234KLJNIMK\317\310\314\312\316\311\005\000#
> \364\005<" (using ==)
> C:/ruby/src/ruby-zlib/specs/deflate/params_spec.rb:16

> 2)
> NameError in 'Zlib::Deflate#set_dictionary sets the dictionary'
> uninitialized constant Zlib::Deflate
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:6
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5:in `each'
> C:/ruby/src/ruby-zlib/specs/deflate/set_dictionary_spec.rb:5

> Finished in 1.688 seconds

> 38 examples, 2 failures

> Ruby 1.8.6-p114 built with VC++ 8
> Windows XP Pro
> RSpec 1.1.11

> Regards,

> Dan

Yeah the github download functionality seems broken for me most of the
time also... :confused:

Anyway, the params failure is the only failure I get. Thats because I've
not implemented the NO_COMPRESSION mode yet, and is an easy fix. The
other error you're getting is odd, as Zlib::Deflate is defined, and if
it weren't none of the other deflate specs would have passed!

Hi,

ยทยทยท

2009/1/10 Daniel Berger <djberg96@gmail.com>:

Hi,

On Jan 8, 8:23 pm, "Heesob Park" <pha...@gmail.com> wrote:

2009/1/8 Daniel Berger <djber...@gmail.com>:

> On Jan 7, 11:08 pm, "Heesob Park" <pha...@gmail.com> wrote:
>> Hi,

>> 2009/1/8 Charles L. <aquas...@gmail.com>:> Daniel Berger wrote:

>> >> Sounds like you're on track. But, you're in a race with Park Heesob. :slight_smile:

>> >> Dan

>> > Heh. :slight_smile: 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. :slight_smile:

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 #<Zlib::GzipReader:
0x2f8e8bc>

I think you need some tests. :wink:

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