2017-11-06 12:27:41 +00:00
|
|
|
require "../src/ameba"
|
|
|
|
require "benchmark"
|
|
|
|
|
2017-11-13 21:20:22 +00:00
|
|
|
private def get_files(n)
|
2017-11-06 12:27:41 +00:00
|
|
|
Dir["src/**/*.cr"].first(n)
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "== Compare:"
|
|
|
|
Benchmark.ips do |x|
|
|
|
|
[
|
|
|
|
1,
|
|
|
|
3,
|
|
|
|
5,
|
|
|
|
10,
|
|
|
|
20,
|
|
|
|
30,
|
|
|
|
40,
|
2023-11-11 18:03:28 +00:00
|
|
|
].each do |n| # ameba:disable Naming/BlockParameterName
|
2017-11-13 21:20:22 +00:00
|
|
|
config = Ameba::Config.load
|
|
|
|
config.formatter = Ameba::Formatter::BaseFormatter.new
|
2019-01-12 21:19:00 +00:00
|
|
|
config.globs = get_files(n)
|
2017-11-06 12:27:41 +00:00
|
|
|
s = n == 1 ? "" : "s"
|
2017-11-13 21:20:22 +00:00
|
|
|
x.report("#{n} source#{s}") { Ameba.run config }
|
2017-11-06 12:27:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "== Measure:"
|
2017-11-17 22:13:14 +00:00
|
|
|
config = Ameba::Config.load
|
|
|
|
config.formatter = Ameba::Formatter::BaseFormatter.new
|
|
|
|
puts Benchmark.measure { Ameba.run config }
|