mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
31 lines
618 B
Crystal
31 lines
618 B
Crystal
require "../src/ameba"
|
|
require "benchmark"
|
|
|
|
private def get_files(n)
|
|
Dir["src/**/*.cr"].first(n)
|
|
end
|
|
|
|
puts "== Compare:"
|
|
Benchmark.ips do |x|
|
|
[
|
|
1,
|
|
3,
|
|
5,
|
|
10,
|
|
20,
|
|
30,
|
|
40,
|
|
].each do |n| # ameba:disable Naming/BlockParameterName
|
|
config = Ameba::Config.load
|
|
config.formatter = Ameba::Formatter::BaseFormatter.new
|
|
config.globs = get_files(n)
|
|
s = n == 1 ? "" : "s"
|
|
x.report("#{n} source#{s}") { Ameba.run config }
|
|
end
|
|
end
|
|
|
|
puts "== Measure:"
|
|
config = Ameba::Config.load
|
|
config.formatter = Ameba::Formatter::BaseFormatter.new
|
|
puts Benchmark.measure { Ameba.run config }
|