Sha256: 8a65aed1c75a9d659cf32b11f08fd4f4146cd53fe930b66231e778b2070b1573
Contents?: true
Size: 984 Bytes
Versions: 5
Compression:
Stored size: 984 Bytes
Contents
#!/usr/bin/env ruby require 'benchmark' require 'ruby_parser' $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require 'parser/all' def measure(what) rp_failures = 0 p_failures = 0 Benchmark.bm(10) do |x| x.report "ruby_parser" do what.each do |file, src| begin Ruby18Parser.new.parse(src) rescue Exception => e puts file puts "RP: #{e.class}: #{e.message}" rp_failures += 1 end end end x.report "parser" do what.each do |file, src| begin Parser::Ruby18.parse(src, file) rescue Parser::SyntaxError p_failures += 1 rescue Exception => e puts file puts "P: #{e.class}: #{e.message}" puts e.backtrace p_failures += 1 end end end end puts puts "Failures: RP: #{rp_failures} P: #{p_failures}" end files = Hash[ARGV.map { |f| [f, File.read(f)] }] measure(files)
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
parser-1.0.1 | bin/benchmark |
parser-1.0.0 | bin/benchmark |
parser-0.9.2 | bin/benchmark |
parser-0.9.1 | bin/benchmark |
parser-0.9.0 | bin/benchmark |