From 47e2faa27d8e37ed9ba15709e02cd6309552ca86 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Tue, 30 Mar 2010 10:18:29 -0700 Subject: [PATCH] add initial benchmark --- benchmark/query.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 benchmark/query.rb diff --git a/benchmark/query.rb b/benchmark/query.rb new file mode 100644 index 0000000..6a6b2f2 --- /dev/null +++ b/benchmark/query.rb @@ -0,0 +1,32 @@ +# encoding: UTF-8 + +require 'rubygems' +require 'benchmark' +require 'mysql' +require 'mysql2_ext' + +number_of = 100 + +Benchmark.bmbm do |x| + GC.start + mysql = Mysql.new("localhost", "root") + mysql.query "USE nbb_development" + x.report do + puts "Mysql" + number_of.times do + mysql_result = mysql.query "SELECT * FROM account_transactions" + mysql_result.each_hash do |res| end + end + end + + GC.start + mysql2 = Mysql2::Client.new + mysql2.query "USE nbb_development" + x.report do + puts "Mysql2" + number_of.times do + mysql2_result = mysql2.query "SELECT * FROM account_transactions" + mysql2_result.each do |res| end + end + end +end \ No newline at end of file