1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/racc/bench.y

37 lines
463 B
Text
Raw Normal View History

2019-05-13 08:25:22 -04:00
class BenchmarkParser
rule
target: a a a a a a a a a a;
a: b b b b b b b b b b;
b: c c c c c c c c c c;
c: d d d d d d d d d d;
d: e e e e e e e e e e;
end
---- inner
def initialize
@old = [ :e, 'e' ]
@i = 0
end
def next_token
return [false, '$'] if @i >= 10_0000
@i += 1
@old
end
def parse
do_parse
end
---- footer
require 'benchmark'
Benchmark.bm do |x|
x.report { BenchmarkParser.new.parse }
end