forked from collectiveidea/delayed_job
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbenchmarks.rb
More file actions
31 lines (25 loc) · 733 Bytes
/
benchmarks.rb
File metadata and controls
31 lines (25 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$:.unshift(File.dirname(__FILE__) + '/lib')
require 'rubygems'
require 'logger'
require 'delayed_job'
require 'benchmark'
Delayed::Worker.logger = Logger.new('/dev/null')
BACKENDS = []
Dir.glob("#{File.dirname(__FILE__)}/spec/setup/*.rb") do |backend|
begin
backend = File.basename(backend, '.rb')
require "spec/setup/#{backend}"
BACKENDS << backend.to_sym
rescue LoadError
puts "Unable to load #{backend} backend! #{$!}"
end
end
Benchmark.bm(10) do |x|
BACKENDS.each do |backend|
require "spec/setup/#{backend}"
Delayed::Worker.backend = backend
n = 10000
n.times { "foo".send_later :length }
x.report(backend.to_s) { Delayed::Worker.new(:quiet => true).work_off(n) }
end
end