File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 22require "benchmark/ips"
33require "csv"
44
5+ require "optparse"
6+
7+ label = nil #: String?
8+
9+ OptionParser . new do |opts |
10+ opts . banner = "Usage: benchmark-parse.rb [options] [file|directory]..."
11+
12+ opts . on ( "--label=LABEL" , "Set the benchmark label" ) do |v |
13+ label = v
14+ end
15+ end . parse! ( ARGV )
16+
17+ file_names = [ ]
518files = { }
619ARGV . each do |file |
20+ path = Pathname ( file )
21+ if path . directory?
22+ Pathname . glob ( path . join ( "**" , "*.rbs" ) ) . each do |p |
23+ file_names << p . to_s
24+ end
25+ else
26+ file_names << path . to_s
27+ end
28+ end
29+
30+ file_names . uniq . each do |file |
731 content = File . read ( file )
832 files [ file ] = RBS ::Buffer . new ( content : content , name : Pathname ( file ) )
933end
1034
11- puts "Benchmarking parsing #{ files . size } files..."
35+ puts "Benchmarking RBS( #{ RBS :: VERSION } in #{ Bundler . default_gemfile . basename } #{ label ? " ( #{ label } )" : "" } ) parsing with #{ files . size } files..."
1236
1337result = Benchmark . ips do |x |
1438 x . report ( "parsing" ) do
You can’t perform that action at this time.
0 commit comments