multi_xml 0.5.5 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +54 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +5 -3
- data/Gemfile +21 -0
- data/LICENSE.md +1 -1
- data/README.md +12 -35
- data/Rakefile +27 -15
- data/lib/multi_xml/parsers/libxml.rb +12 -9
- data/lib/multi_xml/parsers/libxml2_parser.rb +21 -25
- data/lib/multi_xml/parsers/nokogiri.rb +14 -10
- data/lib/multi_xml/parsers/oga.rb +71 -0
- data/lib/multi_xml/parsers/ox.rb +16 -22
- data/lib/multi_xml/parsers/rexml.rb +16 -16
- data/lib/multi_xml/version.rb +1 -1
- data/lib/multi_xml.rb +127 -112
- metadata +37 -69
- data/multi_xml.gemspec +0 -24
- data/spec/helper.rb +0 -17
- data/spec/multi_xml_spec.rb +0 -43
- data/spec/parser_shared_example.rb +0 -694
- data/spec/speed.rb +0 -63
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
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
|