Skip to content
Newer
Older
100755 51 lines (42 sloc) 1.37 KB
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
1 #! /usr/bin/env ruby
2
3 require 'benchmark'
4
fec042d @flavorjones load path for ruby 1.9.x. Closes #1.
authored Apr 5, 2011
5 $: << File.expand_path("./lib")
6 require "fairy_wing_throwdown"
7 require 'flavorjones'
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
8
1aa4738 @flavorjones benchmark.rb outputs platform and nokogiri version info, for better o…
authored May 11, 2011
9 puts
925ae8c @flavorjones updated benchmark script and results for all major rubies.
authored May 18, 2011
10 puts "# ---------- #{RUBY_DESCRIPTION} ----------"
11 puts Nokogiri::VERSION_INFO.to_yaml.gsub(/^/,'# ')
1aa4738 @flavorjones benchmark.rb outputs platform and nokogiri version info, for better o…
authored May 11, 2011
12 puts
13
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
14 json = FairyWingThrowdown.json_string
15 canonical_ruby = FairyWingThrowdown.canonical_ruby
16
925ae8c @flavorjones updated benchmark script and results for all major rubies.
authored May 18, 2011
17 hotspot_enabled_re = /^(jruby|rubinius)/
18
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
19 xml = Flavorjones.xml_string
a41d2ec @flavorjones benchmarks
authored Apr 1, 2011
20 n = 1_000
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
21
2acff6a @flavorjones adding a perftools option for diving into sax parsing. Q: why is it s…
authored Apr 5, 2011
22 if ARGV[0] == "perftools"
23 puts "perftools ..."
24 require 'perftools'
25 PerfTools::CpuProfiler.start("sax_profile") do
925ae8c @flavorjones updated benchmark script and results for all major rubies.
authored May 18, 2011
26 n.times { Flavorjones::XML.new(xml).transform_via_reader }
ea835b8 @flavorjones trying and failing to optimize sax parsing. wow.
authored Apr 1, 2011
27 end
2acff6a @flavorjones adding a perftools option for diving into sax parsing. Q: why is it s…
authored Apr 5, 2011
28
29 else
925ae8c @flavorjones updated benchmark script and results for all major rubies.
authored May 18, 2011
30 benchmark_method = (RUBY_DESCRIPTION =~ hotspot_enabled_re) ? :bmbm : :bm
31 Benchmark.send(benchmark_method, 20) do |benchmark|
2acff6a @flavorjones adding a perftools option for diving into sax parsing. Q: why is it s…
authored Apr 5, 2011
32 benchmark.report("json") do
33 n.times { JSON.parse json }
34 end
925ae8c @flavorjones updated benchmark script and results for all major rubies.
authored May 18, 2011
35 if RUBY_DESCRIPTION == "ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]"
36 benchmark.report("xml (activesupport)") do
37 n.times { Flavorjones::XML.new(xml).transform_via_active_support }
38 end
39 end
2acff6a @flavorjones adding a perftools option for diving into sax parsing. Q: why is it s…
authored Apr 5, 2011
40 benchmark.report("xml (noko-dom)") do
41 n.times { Flavorjones::XML.new(xml).transform_via_dom }
42 end
43 benchmark.report("xml (noko-sax)") do
44 n.times { Flavorjones::XML.new(xml).transform_via_sax }
45 end
3ae1cec @flavorjones implemented a Nokogiri::XML::Reader solution, and added it to the ben…
authored May 11, 2011
46 benchmark.report("xml (noko-reader)") do
47 n.times { Flavorjones::XML.new(xml).transform_via_reader }
48 end
2acff6a @flavorjones adding a perftools option for diving into sax parsing. Q: why is it s…
authored Apr 5, 2011
49 end
d95cbc0 @flavorjones specs to make sure XML transformation is correct. cleaning up code.
authored Apr 1, 2011
50 end
Something went wrong with that request. Please try again.