Created
November 16, 2020 05:54
-
-
Save Loschcode/48630bb2905388f3e0e854138600e63e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# report for each | |
# 0.007854 0.001874 0.009728 ( 0.010521) | |
# report for tally | |
# 0.782440 0.076243 0.858683 ( 0.858839) | |
n=100 | |
Benchmark.bm do |x| | |
x.report do | |
puts "report for each" | |
{}.tap do |metrics| | |
Sidekiq::DeadSet.new.each do |job| | |
metrics[job.klass] ||= 0 | |
metrics[job.klass] += 1 | |
end | |
end.sort_by { |key, value| -value }.to_h | |
end | |
x.report do | |
puts "report for tally" | |
n.times do | |
Sidekiq::DeadSet.new.map(&:klass).tally.sort_by { |key, value| -value }.to_h | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment