Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dilkhush/1edc6055126b30f7e3c8097079c0ff68 to your computer and use it in GitHub Desktop.
Save dilkhush/1edc6055126b30f7e3c8097079c0ff68 to your computer and use it in GitHub Desktop.
Delayed_job #handle_asynchronously Vs custom delayed job benchmarking
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)
@sachin-metacube
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment