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