Sha256: 94ce8050043d7731703d7a8587e0849e88f0a0ec2ed8f2fba3995779a1f6c75e

Contents?: true

Size: 879 Bytes

Versions: 48

Compression:

Stored size: 879 Bytes

Contents

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

require 'rubygems'
require 'benchmark'
require 'active_record'

times = 25


# mysql2
mysql2_opts = {
  :adapter => 'mysql2',
  :database => 'test',
  :pool => times
}
ActiveRecord::Base.establish_connection(mysql2_opts)
x = Benchmark.realtime do
  threads = []
  times.times do
    threads << Thread.new { ActiveRecord::Base.connection.execute("select sleep(1)") }
  end
  threads.each {|t| t.join }
end
puts "mysql2: #{x} seconds"


# mysql
mysql2_opts = {
  :adapter => 'mysql',
  :database => 'test',
  :pool => times
}
ActiveRecord::Base.establish_connection(mysql2_opts)
x = Benchmark.realtime do
  threads = []
  times.times do
    threads << Thread.new { ActiveRecord::Base.connection.execute("select sleep(1)") }
  end
  threads.each {|t| t.join }
end
puts "mysql: #{x} seconds"

Version data entries

48 entries across 48 versions & 5 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
mysql2-0.2.19b4 benchmark/active_record_threaded.rb
mysql2-0.3.12b4 benchmark/active_record_threaded.rb
mysql2-0.2.19b3 benchmark/active_record_threaded.rb
mysql2-0.3.12b3 benchmark/active_record_threaded.rb
mysql2-0.3.12b2 benchmark/active_record_threaded.rb
mysql2-0.2.19b2 benchmark/active_record_threaded.rb
mysql2-0.3.12b1 benchmark/active_record_threaded.rb
mysql2-0.2.19b1 benchmark/active_record_threaded.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/benchmark/active_record_threaded.rb
mysql2-sp-0.3.10 benchmark/active_record_threaded.rb
solaris-mysql2-0.3.11 benchmark/active_record_threaded.rb
mysql2-0.3.11-x86-mswin32-60 benchmark/active_record_threaded.rb
mysql2-0.3.11-x86-mingw32 benchmark/active_record_threaded.rb
mysql2-0.3.11 benchmark/active_record_threaded.rb
mysql2-0.2.18-x86-mswin32-60 benchmark/active_record_threaded.rb