File: benchmark.rb

package info (click to toggle)
ruby-nori 2.6.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 252 kB
  • sloc: ruby: 1,155; xml: 266; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 379 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$:.push File.expand_path("../../lib", __FILE__)
require "nori"

require "benchmark"

Benchmark.bm 30 do |x|

  num = 500
  xml = File.read File.expand_path("../soap_response.xml", __FILE__)

  x.report "rexml parser" do
    num.times { Nori.new(parser: :rexml).parse xml }
  end

  x.report "nokogiri parser" do
    num.times { Nori.new(parser: :nokogiri).parse xml }
  end

end