File: minimal_regexp.rb

package info (click to toggle)
ruby-regexp-parser 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 968 kB
  • sloc: ruby: 6,396; sh: 12; makefile: 6
file content (13 lines) | stat: -rw-r--r-- 336 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'benchmark/ips'
require_relative '../../lib/regexp_parser'

puts 'Parsing a minimal Regexp'

regexp = /./

Benchmark.ips do |x|
  x.report('Scanner::scan') { Regexp::Scanner.scan(regexp) }
  x.report('Lexer::lex')    { Regexp::Lexer.lex(regexp)    }
  x.report('Parser::parse') { Regexp::Parser.parse(regexp) }
  x.compare!
end