From: Robert Feldt Date: 2001-10-30T07:05:52+09:00 Subject: [ruby-talk:23760] Re: Some inspirations from REBOL On Tue, 30 Oct 2001, Ned Konz wrote: > On Monday 29 October 2001 10:17 am, Michael Neumann wrote: > > > Maybe great, but very slow. Why not make it a standard C-extension and > > distribute it with Ruby? It would run on any platform. > > Well, there's already ruby/zlib. > Another issue in this discussion is size. Mini-LZO (only one compressor and on decompressor, the full LZO has many options etc) in C is only about 6 kB when compiled, its simple and fast. A Ruby wrapper would add almost nothing. My guess is that zlib would be considerably larger. I worry about these things since I'd like to see one and the same Ruby env also on small PDA's etc. With this in mind LZO is better if we want to go to C. How fast is it? Well here's some figures from the lzo homepage: "Here are some timings on my old Intel Pentium 133: memcpy(): ~60 MB/sec LZO1X decompression in C: ~16 MB/sec LZO1X decompression in optimized assembler: ~20 MB/sec LZO1X-1 compression: ~5 MB/sec" I consider 30% the speed of memcpy fast. ;-) (And IMHO decompression is the intersting thing since compression can be done "off-line") And note that even if a Ruby implementation would be more portable these algorithms look kind of magic since they are so optimized so they will not look much better if implemented in Ruby. So maybe going to C is the way to do it. I think the LZO designers actively are trying to only use ANSI-C stuff so that it should compile cleanly on most everything with a C compiler. Anyway I would strongly encourage someone to do a Ruby wrapper of miniLZO. It should be very straightforward with only 3 functions to wrap. So much simpler than zlibs plethora of stuff. I would think that these 2-3 methods catch 90% of the usage scenarios. Anyone got the time? /Robert Ps. Ryan: I agree with you that we should work to increase the speed of Ruby. There are some japanese guys who hope to release a faster Ruby engine this year (I'm unsure how much of an experimental project it is) and there will be some interesting stuff in connection with AOS. Its exciting Ruby times...