[Rubygems-developers] The yaml file.

Hugh Sasse Staff Elec Eng hgs at dmu.ac.uk
Thu Mar 3 07:20:40 EST 2005


I've found downloading the yaml file, which happens whenever I do
updates, to be rather slow over a 56k line.  (OK, I can't expect
much to be fast over such a line, but still, we are trying to
support the largest user base possible.).  So, I look in the code
and see that it is yaml.Z  I think "compress, and not gzip?".
I think: I'll do some tests to see if gzip is much smaller, because
I have written gunzip support for http in ruby....

I get the file, but I can't use gunzip to uncompress it, or
uncompress, or unzip.  I've unpacked it using

require 'zlib'
yaml_spec = File.open("./yaml.Z"){|f| f.read() }
yaml_spec = Zlib::Inflate.inflate(yaml_spec)

File.open('yaml', 'w'){|f| f.print yaml_spec }

and then I tried gzip -9 (results with just gzip were slightly
bigger than zlib):

brains hgs 227 %> ls -l
total 7346
-rw-r--r--   1 hgs      staff        158 Mar  3 12:08 uncompact.rb
-rw-r--r--   1 hgs      staff     312839 Mar  2 13:55 yaml.Z
-rw-r--r--   1 hgs      staff     303443 Mar  3 12:08 yaml.gz
-rw-r--r--   1 hgs      staff    2772407 Mar  3 12:08 yaml.orig
brains hgs 228 %> ruby -e 'puts 303443.0 / 312839.0 '
0.96996538155409
brains hgs 229 %> gunzip yaml
brains hgs 230 %> bzip2 yaml
brains hgs 231 %> ls -l
total 7074
-rw-r--r--   1 hgs      staff        158 Mar  3 12:08 uncompact.rb
-rw-r--r--   1 hgs      staff     312839 Mar  2 13:55 yaml.Z
-rw-r--r--   1 hgs      staff     170235 Mar  3 12:08 yaml.bz2
-rw-r--r--   1 hgs      staff    2772407 Mar  3 12:08 yaml.orig
brains hgs 232 %> ruby -e 'puts 170235.0 / 312839.0 '
0.544161693395005
brains hgs 233 %>

Questions that arise are:
Is about a 4% saving worth moving to gzip?
Does anyone know of plans (or reasons for the absence of plans) to
add bzip2 support to ruby?
What actually is the compressed format used now, given that I can't
read it except with ruby?


More information about the Rubygems-developers mailing list