Skip to content

Instantly share code, notes, and snippets.

@nrk
Created July 29, 2010 19:31
Show Gist options
  • Save nrk/498997 to your computer and use it in GitHub Desktop.
Save nrk/498997 to your computer and use it in GitHub Desktop.
JSON under IronRuby (and comparisons)
C:\IronRuby\v1.1.0>ir json_speed.rb pure
Rehearsal ------------------------------------
474.906250 39.421875 514.328125 (394.262696)
------------------------- total: 514.328125sec
user system total real
482.531250 43.140625 525.671875 (384.509766)
C:\IronRuby\v1.1.0>ir json_speed.rb ext
Rehearsal ------------------------------------
0.140625 0.000000 0.140625 ( 0.145508)
--------------------------- total: 0.140625sec
user system total real
0.062500 0.000000 0.062500 ( 0.071289)
C:\IronRuby\v1.1.0>jruby json_speed.rb pure
Rehearsal ------------------------------------
1.649000 0.000000 1.649000 ( 1.649000)
--------------------------- total: 1.649000sec
user system total real
0.673000 0.000000 0.673000 ( 0.673000)
C:\IronRuby\v1.1.0>jruby json_speed.rb ext
Rehearsal ------------------------------------
0.303000 0.000000 0.303000 ( 0.302000)
--------------------------- total: 0.303000sec
user system total real
0.096000 0.000000 0.096000 ( 0.096000)
require 'open-uri'
require 'benchmark'
variant = ARGV[0] || 'ext'
require "json/#{variant}"
data = open('510kbyte.json').read
Benchmark.bmbm do |x|
x.report do
JSON.parse(data)
end
end
C:\IronRuby\v1.1.0>ruby json_speed.rb pure
Rehearsal ------------------------------------
0.625000 0.000000 0.625000 ( 0.624000)
--------------------------- total: 0.625000sec
user system total real
0.610000 0.000000 0.610000 ( 0.615000)
C:\IronRuby\v1.1.0>ruby json_speed.rb ext
Rehearsal ------------------------------------
0.047000 0.000000 0.047000 ( 0.036000)
--------------------------- total: 0.047000sec
user system total real
0.031000 0.000000 0.031000 ( 0.023000)
@nrk
Copy link
Author

nrk commented Jul 29, 2010

I wonder why json/pure performs that bad under IronRuby, even after the first run (which is even more surprising since it's actually slower in the second run). I can't really figure where's the bottleneck...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment