Skip to content

Instantly share code, notes, and snippets.

@ebryn
Created October 21, 2010 19:41
Show Gist options
  • Save ebryn/639168 to your computer and use it in GitHub Desktop.
Save ebryn/639168 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'bench_press'
# begin gem 'odbc', '0.99992' ; rescue Gem::LoadError ; end
require 'odbc'
$:.unshift File.expand_path('../../../lib',__FILE__)
require 'tiny_tds'
extend BenchPress
author 'Erik Bryn'
summary 'Benchmarking comparison between TinyTds and Ruby-ODBC'
reps 1_000
$query_all = "SELECT * FROM [datatypes]"
measure "Ruby-ODBC" do
client = ODBC.connect 'tinytds', 'tinytds', ''
client.use_time = true
h = client.run($query_all)
h.fetch_all
h.drop
end
measure "TinyTds" do
client = TinyTds::Client.new({
:host => ENV['TINYTDS_UNIT_HOST'] || 'local',
:username => 'tinytds',
:password => '',
:database => 'tinytds_test',
:appname => 'TinyTds Dev',
:login_timeout => 5,
:timeout => 5
})
client.execute($query_all).each
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment