Last active
September 29, 2015 12:08
-
-
Save morten/1598652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'psych' | |
require 'yaml' | |
data = [ 1 , { "hello hello" => "moo moo", :aaa => [] } ] * 100 | |
yaml = YAML.dump(data) | |
time = Benchmark.realtime { 10000.times { YAML.load(yaml) }} | |
puts "Time #{YAML}: #{time}" | |
YAML::ENGINE.yamler = "syck" | |
time = Benchmark.realtime { 10000.times { YAML.load(yaml) }} | |
puts "Time #{YAML}: #{time}" | |
__END__ | |
~/tmp$ ruby -v test.rb | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
malloc_limit=100000000 (8000000) | |
heap_min_slots=500000 (10000) | |
Time Psych: 15.395857 | |
Time Syck: 3.098056 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment