Sha256: bf78a0628ad7cf014eb2ed01325bc979408938f920a9b958e8f6b09548091cf8

Contents?: true

Size: 937 Bytes

Versions: 47

Compression:

Stored size: 937 Bytes

Contents

# ./test/resque-mongo_benchmark.rb

#require 'rubygems'
#require 'resque-mongo'
require File.join(File.dirname(__FILE__), 'test_helper')
require 'benchmark'

class SimpleJob
  def self.perform
    "Awesome"
  end
end

class Job1 < SimpleJob
  @queue = :q1
end

class Job2 < SimpleJob
  @queue = :q2
end

class Job3 < SimpleJob
  @queue = :q3
end

class Job4 < SimpleJob
  @queue = :q4
end

class Array
  def rand
    self[Kernel.rand(length)]
  end
end

a = [0,1,2,3,4,5,6]

Resque.drop

result = Benchmark.measure do
  [Job1, Job2, Job3, Job4, Job3, Job2, Job1].each do |job|
    100.times do
      Resque.enqueue(job)
    end
  end
end

puts "Enqueuing"
puts result

worker = Resque::Worker.new("q1", "q2", "q3", "q4")
result = Benchmark.measure { worker.work(0) }

puts "Working"
puts result

# With 7 000 entries
#
# Enqueuing
#   1.250000   0.150000   1.400000 (  1.403977)
# Working
#  10.220000   1.020000  11.240000 ( 80.512621)

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
classiccms-0.5.13 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.12 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.11 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.10 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.9 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.8 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.7 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.6 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.5 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.2 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.1 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.5.0 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.4.2 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.4.1 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.4.0 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.3.9 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.3.8 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.3.7 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.3.6 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb
classiccms-0.3.5 vendor/bundle/gems/resque-mongo-1.9.8.1/test/resque-mongo_benchmark.rb