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
2019-06-19 18:17:25 +09:00

36 lines
463 B
Text

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