Sha256: 63a1d53aacbf057b52c31e35c0cc33adb976d4010481ebf54d91744bdc038b8d
Contents?: true
Size: 1.11 KB
Versions: 6
Compression:
Stored size: 1.11 KB
Contents
# encoding: UTF-8 $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'rubygems' require 'benchmark' require 'mysql' require 'mysql2' require 'do_mysql' number_of = 100 database = 'test' sql = "SELECT * FROM mysql2_test LIMIT 100" Benchmark.bmbm do |x| mysql2 = Mysql2::Client.new(:host => "localhost", :username => "root") mysql2.query "USE #{database}" x.report "Mysql2" do number_of.times do mysql2_result = mysql2.query sql, :symbolize_keys => true mysql2_result.each do |res| # puts res.inspect end end end mysql = Mysql.new("localhost", "root") mysql.query "USE #{database}" x.report "Mysql" do number_of.times do mysql_result = mysql.query sql mysql_result.each_hash do |res| # puts res.inspect end end end do_mysql = DataObjects::Connection.new("mysql://localhost/#{database}") command = DataObjects::Mysql::Command.new do_mysql, sql x.report "do_mysql" do number_of.times do do_result = command.execute_reader do_result.each do |res| # puts res.inspect end end end end
Version data entries
6 entries across 6 versions & 3 rubygems