Sha256: ab3781d3fd33aac157c4ba12b7e19075279ae3293ac615056cbf71aea9dd9e37
Contents?: true
Size: 872 Bytes
Versions: 50
Compression:
Stored size: 872 Bytes
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' def run_escape_benchmarks(str, number_of = 1000) Benchmark.bmbm do |x| mysql = Mysql.new("localhost", "root") x.report "Mysql #{str.inspect}" do number_of.times do mysql.quote str end end mysql2 = Mysql2::Client.new(:host => "localhost", :username => "root") x.report "Mysql2 #{str.inspect}" do number_of.times do mysql2.escape str end end do_mysql = DataObjects::Connection.new("mysql://localhost/test") x.report "do_mysql #{str.inspect}" do number_of.times do do_mysql.quote_string str end end end end run_escape_benchmarks "abc'def\"ghi\0jkl%mno" run_escape_benchmarks "clean string"
Version data entries
50 entries across 50 versions & 6 rubygems