Last active
January 19, 2018 09:01
-
-
Save dilkhush/1edc6055126b30f7e3c8097079c0ff68 to your computer and use it in GitHub Desktop.
Delayed_job #handle_asynchronously Vs custom delayed job benchmarking
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
require 'benchmark' | |
u = User.find 1 | |
no_of_count = 1000 | |
Benchmark.bmbm do |x| | |
x.report("handle_asynchronously") { no_of_count.times { u.method_name_for_background_run } } | |
x.report("custom delayed job") { no_of_count.times { TestJob.new(u.id).delay } } | |
end | |
Output: | |
label user system total real | |
handle_asynchronously 17.280000 0.470000 17.750000 ( 39.411810) | |
custom delayed job 0.000000 0.000000 0.000000 ( 0.001252) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍