Sha256: 233a8397ba4e235fca1a5c9727f20689289fc26b494cd3cb7ca894af5c24f323

Contents?: true

Size: 528 Bytes

Versions: 5

Compression:

Stored size: 528 Bytes

Contents

# encoding: UTF-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'rubygems'
require 'benchmark'
require 'mysql2'

iterations = 1000
client = Mysql2::Client.new(:host => "localhost", :username => "root", :database => "test")
query = lambda{ iterations.times{ client.query("SELECT mysql2_test.* FROM mysql2_test") } }
Benchmark.bmbm do |x|
  x.report('select') do
    query.call
  end
  x.report('rb_thread_select') do
    thread = Thread.new{ sleep(10) }
    query.call
    thread.kill
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mysql2-0.2.4 benchmark/thread_alone.rb
mysql2-0.2.3 benchmark/thread_alone.rb
mysql2-0.2.2 benchmark/thread_alone.rb
mysql2-0.2.1 benchmark/thread_alone.rb
mysql2-0.2.0 benchmark/thread_alone.rb