Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove yaml based on JvYAMLb and add Yecht version 0.0.1 instead. Als…
…o update yaml tests as a copy from Ruby 1.8.7.
  • Loading branch information
olabini committed Jul 26, 2009
1 parent 877efe0 commit dc8d7f6
Show file tree
Hide file tree
Showing 37 changed files with 3,165 additions and 2,620 deletions.
20 changes: 20 additions & 0 deletions bench/bench_yaml.rb
@@ -0,0 +1,20 @@

require 'benchmark'
require 'yaml'

def bench_yaml(bm)
oldbm = $bm
$bm = bm

str = File.read(File.join(File.dirname(__FILE__), "big_yaml.yml"))
result = YAML.load(str)

$bm.report("1k parse") { 1_000.times { YAML.parse(str) } }
$bm.report("1k loads") { 1_000.times { YAML.load(str) } }
$bm.report("1k dumps") { 1_000.times { result.to_yaml } }
$bm.report("1k roundtrip") { 1_000.times { YAML.load(result.to_yaml) } }
end

if $0 == __FILE__
(ARGV[0] || 10).to_i.times { Benchmark.bm(30) {|bm| bench_yaml(bm)} }
end

0 comments on commit dc8d7f6

Please sign in to comment.