update benchmark script
This commit is contained in:
parent
47e2faa27d
commit
82545702fe
@ -5,28 +5,39 @@ require 'benchmark'
|
|||||||
require 'mysql'
|
require 'mysql'
|
||||||
require 'mysql2_ext'
|
require 'mysql2_ext'
|
||||||
|
|
||||||
number_of = 100
|
number_of = 1
|
||||||
|
database = 'nbb_1_production'
|
||||||
|
|
||||||
Benchmark.bmbm do |x|
|
Benchmark.bmbm do |x|
|
||||||
GC.start
|
GC.start
|
||||||
mysql = Mysql.new("localhost", "root")
|
mysql = Mysql.new("localhost", "root")
|
||||||
mysql.query "USE nbb_development"
|
mysql.query "USE #{database}"
|
||||||
x.report do
|
x.report do
|
||||||
puts "Mysql"
|
puts "Mysql"
|
||||||
number_of.times do
|
number_of.times do
|
||||||
mysql_result = mysql.query "SELECT * FROM account_transactions"
|
mysql_result = mysql.query "SELECT * FROM account_transactions"
|
||||||
mysql_result.each_hash do |res| end
|
number = 0
|
||||||
|
mysql_result.each_hash do |res|
|
||||||
|
number += 1
|
||||||
|
# puts res.inspect
|
||||||
|
end
|
||||||
|
puts "Processed #{number} results"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
GC.start
|
GC.start
|
||||||
mysql2 = Mysql2::Client.new
|
mysql2 = Mysql2::Client.new
|
||||||
mysql2.query "USE nbb_development"
|
mysql2.query "USE #{database}"
|
||||||
x.report do
|
x.report do
|
||||||
puts "Mysql2"
|
puts "Mysql2"
|
||||||
number_of.times do
|
number_of.times do
|
||||||
mysql2_result = mysql2.query "SELECT * FROM account_transactions"
|
mysql2_result = mysql2.query "SELECT * FROM account_transactions"
|
||||||
mysql2_result.each do |res| end
|
number = 0
|
||||||
|
mysql2_result.each(:symbolize_keys => true) do |res|
|
||||||
|
number += 1
|
||||||
|
# puts res.inspect
|
||||||
|
end
|
||||||
|
puts "Processed #{number} results"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user