Sha256: 5d72f3a82b5f55ad753c61feff00860ddd94d30762fbe65775324526e0e05e2b

Contents?: true

Size: 657 Bytes

Versions: 5

Compression:

Stored size: 657 Bytes

Contents

# encoding: UTF-8

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

5 entries across 5 versions & 1 rubygems

Version Path
mysql2-0.1.7 benchmark/escape.rb
mysql2-0.1.6 benchmark/escape.rb
mysql2-0.1.5 benchmark/escape.rb
mysql2-0.1.4 benchmark/escape.rb
mysql2-0.1.3 benchmark/escape.rb