Sha256: 0d28dfbf8c44885684c82d530dc134e2360adcf290aa3e1dc506688e8eb1eac3

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

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

require 'rubygems'
require 'benchmark'
require 'mysql'
require 'mysql2_ext'
require 'do_mysql'

number_of = 1000
str = "abc'def\"ghi\0jkl%mno"

Benchmark.bmbm do |x|
  mysql = Mysql.new("localhost", "root")
  x.report do
    puts "Mysql"
    number_of.times do
      mysql.quote str
    end
  end

  mysql2 = Mysql2::Client.new(:host => "localhost", :username => "root")
  x.report do
    puts "Mysql2"
    number_of.times do
      mysql2.escape str
    end
  end

  do_mysql = DataObjects::Connection.new("mysql://localhost/test")
  x.report do
    puts "do_mysql"
    number_of.times do
      do_mysql.quote_string str
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mysql2-0.1.8 benchmark/escape.rb