test/parser_comparison.rb in Sutto-marvin-0.1.20081120 vs test/parser_comparison.rb in Sutto-marvin-0.2.0
- old
+ new
@@ -31,6 +31,32 @@
end
puts ""
end
puts ""
-end
\ No newline at end of file
+end
+
+puts ""
+puts ""
+puts "==============="
+puts "| SPEED TESTS |"
+puts "==============="
+puts ""
+
+width = PARSERS.map { |p| p.name.length }.max + 2
+
+ITERATIONS = 1000
+
+Benchmark.bm(width) do |b|
+ PARSERS.each do |parser|
+ b.report("#{parser.name}: ") do
+ LINES.each do |l|
+ ITERATIONS.times do
+ e = parser.new(l).to_event
+ unless e.nil?
+ e.to_hash # Get a hash
+ end
+ end
+ end
+ end
+ end
+end