Sha256: 03eb0e641303783ba1843f520f572c2ad8cfe1d67f81f94a18186f09a10fe6d9

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

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

require 'rubygems'
require 'benchmark'
require 'sequel'
require 'sequel/adapters/do'

number_of = 10
mysql2_opts = "mysql2://localhost/test"
mysql_opts = "mysql://localhost/test"
do_mysql_opts = "do:mysql://localhost/test"

class Mysql2Model < Sequel::Model(Sequel.connect(mysql2_opts)[:mysql2_test]); end
class MysqlModel < Sequel::Model(Sequel.connect(mysql_opts)[:mysql2_test]); end
class DOMysqlModel < Sequel::Model(Sequel.connect(do_mysql_opts)[:mysql2_test]); end

Benchmark.bmbm do |x|
  x.report do
    puts "Mysql2"
    number_of.times do
      Mysql2Model.limit(1000).all
    end
  end

  x.report do
    puts "do:mysql"
    number_of.times do
      DOMysqlModel.limit(1000).all
    end
  end

  x.report do
    puts "Mysql"
    number_of.times do
      MysqlModel.limit(1000).all
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mysql2-0.1.8 benchmark/sequel.rb