From: Robert Dober Date: 2007-05-07T20:55:45+09:00 Subject: Re: Beyond YAML? (scaling) On 5/7/07, Bil Kleb wrote: Bill, maybe you want to have a look at JSON http://json.rubyforge.org/ I do not have time right now to benchmark the reading, but the writing gives some spectacular results, look at this: 517/17 > cat test-out.rb && ruby test-out.rb # vim: sts=2 sw=2 expandtab nu tw=0: require 'yaml' require 'rubygems' require 'json' require 'benchmark' @hash = Hash[*(1..100).map{|l| "k_%03d" % l}.zip([*1..100]).flatten] Benchmark.bmbm do |bench| bench.report( "yaml" ) { 50.times{ @hash.to_yaml } } bench.report( "json" ) { 50.times{ @hash.to_json } } end Rehearsal ---------------------------------------- yaml 0.630000 0.030000 0.660000 ( 0.748123) json 0.020000 0.000000 0.020000 ( 0.079732) ------------------------------- total: 0.680000sec user system total real yaml 0.590000 0.000000 0.590000 ( 0.754097) json 0.020000 0.000000 0.020000 ( 0.018363) Looks promising, n'est-ce pas? Maybe you want to investigate that a little bit more, JSON is of course very readable, look e.g at this: irb(main):002:0> require 'rubygems' => true irb(main):003:0> require 'json' => true irb(main):004:0> {:a => [*42..84]}.to_json => "{\"a\":[42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84]}" HTH Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw