Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
rrq / spec / lib / performance_spec.rb
Size: Mime:
require 'spec_helper'

describe "Performance" do 
  before do
    @payload = {
      test: 123
    }
  end

  it "testing 1000 pushes" do 
    benchmark = Benchmark.measure do 
      1000.times { |n| $rrq_conn.push("test_queue", n, @payload) }
    end
    puts benchmark
  end

  it "testing 1000 pushes via bulk_push" do 
    benchmark = Benchmark.measure do
      args = 1000.times.to_a.map { @payload }
      $rrq_conn.bulk_push("test_queue", 1, args)
    end
    puts benchmark
  end

  it "testing 1000 pops" do 
    1000.times { |n| $rrq_conn.push("test_queue", n, @payload) }

    benchmark = Benchmark.measure do 
      1000.times { |n| $rrq_conn.pop }
    end
    puts benchmark
  end
end