Sha256: 37c217ae5ab3447ca44c52a85c7f15d6b9a0e4f65e54b9af538cc0a9656054cf

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

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

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

number_of = 10
mysql2_opts = {
  :adapter => 'mysql2',
  :database => 'test'
}
mysql_opts = {
  :adapter => 'mysql',
  :database => 'test'
}

class TestModel < ActiveRecord::Base
  set_table_name :mysql2_test
end

Benchmark.bmbm do |x|
  x.report do
    TestModel.establish_connection(mysql2_opts)
    puts "Mysql2"
    number_of.times do
      TestModel.all(:limit => 1000)
    end
  end

  x.report do
    TestModel.establish_connection(mysql_opts)
    puts "Mysql"
    number_of.times do
      TestModel.all(:limit => 1000)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mysql2-0.1.4 benchmark/active_record.rb