Skip to content

Commit 3acbb70

Browse files
committed
Add loading multiple files benchmark
1 parent 6ada4aa commit 3acbb70

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

benchmarks2.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require "rbs"
2+
require "benchmark/ips"
3+
require "csv"
4+
require "pathname"
5+
6+
files = {}
7+
ARGV.each do |file|
8+
content = File.read(file)
9+
files[file] = RBS::Buffer.new(content: content, name: Pathname(file))
10+
end
11+
12+
puts "Benchmarking parsing #{files.size} files..."
13+
14+
Benchmark.ips do |x|
15+
x.report("parsing") do
16+
files.each do |file, content|
17+
RBS::Parser.parse_signature(content)
18+
end
19+
end
20+
21+
x.compare!
22+
end

0 commit comments

Comments
 (0)