Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Benchmark for YAML with JSON strings
require 'securerandom'
require 'yaml'
require 'json'
require 'benchmark'
hash = { values: 5000.times.collect{ SecureRandom.random_number } }
yaml_hash = { json: hash.to_json }
yaml_string = YAML.dump(yaml_hash)
puts JRUBY_VERSION
puts Benchmark.measure { YAML.load(yaml_string) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment