multi_xml 0.5.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/speed.rb DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env ruby -wW1
2
-
3
- $: << '.'
4
- $: << '../lib'
5
-
6
- if __FILE__ == $0
7
- while (i = ARGV.index('-I'))
8
- x,path = ARGV.slice!(i, 2)
9
- $: << path
10
- end
11
- end
12
-
13
- require 'optparse'
14
- require 'stringio'
15
- require 'multi_xml'
16
-
17
- begin
18
- require 'libxml'
19
- rescue Exception => e
20
- end
21
- begin
22
- require 'nokogiri'
23
- rescue Exception => e
24
- end
25
- begin
26
- require 'ox'
27
- rescue Exception => e
28
- end
29
-
30
- $verbose = 0
31
- $parsers = []
32
- $iter = 10
33
-
34
- opts = OptionParser.new
35
- opts.on("-v", "increase verbosity") { $verbose += 1 }
36
- opts.on("-p", "--parser [String]", String, "parser to test") { |p| $parsers = [p] }
37
- opts.on("-i", "--iterations [Int]", Integer, "iterations") { |i| $iter = i }
38
- opts.on("-h", "--help", "Show this display") { puts opts; Process.exit!(0) }
39
- files = opts.parse(ARGV)
40
-
41
- if $parsers.empty?
42
- $parsers << 'libxml' if defined?(::LibXML)
43
- $parsers << 'nokogiri' if defined?(::Nokogiri)
44
- $parsers << 'ox' if defined?(::Ox)
45
- end
46
-
47
- files.each do |filename|
48
- times = { }
49
- xml = File.read(filename)
50
- $parsers.each do |p|
51
- MultiXml.parser = p
52
- start = Time.now
53
- $iter.times do |i|
54
- io = StringIO.new(xml)
55
- MultiXml.parse(io)
56
- end
57
- dt = Time.now - start
58
- times[p] = Time.now - start
59
- end
60
- times.each do |p,t|
61
- puts "%8s took %0.3f seconds to parse %s %d times." % [p, t, filename, $iter]
62
- end
63
- end
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file