Sha256: 5a0ff841a9cc716d771454c9909cf1e54c8a503c8b77c43f334af82cbdf5d3f8
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
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 'active_record' number_of = 10 mysql2_opts = { :adapter => 'mysql2', :database => 'test' } mysql_opts = { :adapter => 'mysql', :database => 'test' } class Mysql2Model < ActiveRecord::Base set_table_name :mysql2_test end class MysqlModel < ActiveRecord::Base set_table_name :mysql2_test end Benchmark.bmbm do |x| x.report do Mysql2Model.establish_connection(mysql2_opts) puts "Mysql2" number_of.times do Mysql2Model.all(:limit => 1000).each{ |r| r.attributes.keys.each{ |k| r.send(k.to_sym) } } end end x.report do MysqlModel.establish_connection(mysql_opts) puts "Mysql" number_of.times do MysqlModel.all(:limit => 1000).each{ |r| r.attributes.keys.each{ |k| r.send(k.to_sym) } } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mysql2-0.1.8 | benchmark/active_record.rb |