Created
May 8, 2024 09:57
-
-
Save anoobbava/b3d67f798c8296a5c635bd4d9b893075 to your computer and use it in GitHub Desktop.
gist Benchmark
This file contains 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
class BenchmarkEvaluator | |
def initialize(count) | |
@count = count | |
end | |
def execute | |
results = {} | |
Rails.logger.info '===== Enqueuing jobs' | |
benchmark = "Enqueuing #{@count} ActiveJob jobs" | |
results[benchmark] = Benchmark.measure do | |
@count.times do |i| | |
SampleJob.perform_later('hello') | |
end | |
end.real.round(2) | |
Rails.logger.info "Duration: #{results[benchmark]} seconds" | |
Rails.logger.info "Duration: #{results}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment