Skip to content

Instantly share code, notes, and snippets.

@joshed-io
Created June 24, 2013 18:16
Show Gist options
  • Select an option

  • Save joshed-io/5852208 to your computer and use it in GitHub Desktop.

Select an option

Save joshed-io/5852208 to your computer and use it in GitHub Desktop.
Ruby JSON performance benchmark
require 'json'
require 'benchmark'
json = {
:one => {
:two => {
:three => {
:four => {
:five => {
:six => {
:seven => :eight,
:nine => "TENTENTENTENTENTENTENTENTENTENTENTENTENTENTENTEN"
}
}
}
}
}
}
}
Benchmark.bm do |x|
x.report("JSON dump: ") { 500.times{ JSON.dump(json) } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment