Created
March 21, 2018 00:54
-
-
Save vassilios/ddbbb499aaa0d4cdd241d6c7e06f08eb to your computer and use it in GitHub Desktop.
Benchmark for YAML with JSON strings
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 '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