Sha256: 377498d95e07f30286e7b2aa8bab99d62eb8c5a95c7b16eeecd2d522c93c3b12

Contents?: true

Size: 622 Bytes

Versions: 7

Compression:

Stored size: 622 Bytes

Contents

#!/usr/local/bin/ruby -w

$LOAD_PATH.unshift("../lib")

require 'madeleine'
require 'batched'

class BenchmarkCommand
  def initialize(value)
    @value = value
  end

  def execute(system)
    # do nothing
  end
end

madeleine = BattchedSnapshotMadeleine.new("benchmark-base") { :the_system }

RUNS = 200
THREADS = 10

GC.start
GC.disable

t0 = Time.now

threads = []
THREADS.times {
  threads << Thread.new {
    RUNS.times {
      madeleine.execute_command(BenchmarkCommand.new(1234))
    }
  }
}
threads.each {|t| t.join }
t1 = Time.now

GC.enable

tps = (THREADS * RUNS)/(t1 - t0)

puts "#{tps.to_i} transactions/s"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
madeleine-0.9.0 contrib/threaded_benchmark.rb
madeleine-0.9.0.pre contrib/threaded_benchmark.rb
madeleine-0.8.0 contrib/threaded_benchmark.rb
madeleine-0.8.0.pre contrib/threaded_benchmark.rb
madeleine-0.7.3 contrib/threaded_benchmark.rb
madeleine-0.7.1 contrib/threaded_benchmark.rb
madeleine-0.7.2 contrib/threaded_benchmark.rb