Created
October 20, 2010 04:40
-
-
Save ebryn/635779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ejb-mbp2:activerecord-sqlserver-adapter ebryn$ ruby test/benchmark/query_sqlserver.rb | |
-- create_table(:test_benchmarks, {:force=>true}) | |
-> 0.0715s | |
Query Sqlserver | |
=============== | |
Author: Erik Bryn | |
Date: October 19, 2010 | |
Summary: Benchmark SQL Server Queries | |
System Information | |
------------------ | |
Operating System: Mac OS X 10.6.4 (10F569) | |
CPU: Intel Core 2 Duo 3.06 GHz | |
Processor Count: 2 | |
Memory: 6 GB | |
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02 | |
"Raw find" is up to 86% faster over 1,000 repetitions | |
----------------------------------------------------- | |
Raw find 0.642855882644653 secs Fastest | |
Raw insert 0.959434986114502 secs 32% Slower | |
Simple find 1.14748501777649 secs 43% Slower | |
Simple insert 4.71043491363525 secs 86% Slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- create_table(:test_benchmarks, {:force=>true}) | |
-> 0.0650s | |
Query Sqlite | |
============ | |
Author: Erik Bryn | |
Date: October 19, 2010 | |
Summary: Benchmark simple SQLite queries through ActiveRecord | |
System Information | |
------------------ | |
Operating System: Mac OS X 10.6.4 (10F569) | |
CPU: Intel Core 2 Duo 3.06 GHz | |
Processor Count: 2 | |
Memory: 6 GB | |
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02 | |
"Simple find" is up to 88% faster over 1,000 repetitions | |
-------------------------------------------------------- | |
Simple find 0.205985069274902 secs Fastest | |
Simple insert 1.7200140953064 secs 88% Slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- create_table(:test_benchmarks, {:force=>true}) | |
-> 0.3976s | |
Query Mysql | |
=========== | |
Author: Erik Bryn | |
Date: October 19, 2010 | |
Summary: Benchmark simple MySQL queries through ActiveRecord | |
System Information | |
------------------ | |
Operating System: Mac OS X 10.6.4 (10F569) | |
CPU: Intel Core 2 Duo 3.06 GHz | |
Processor Count: 2 | |
Memory: 6 GB | |
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02 | |
"Simple find" is up to 89% faster over 1,000 repetitions | |
-------------------------------------------------------- | |
Simple find 0.515031099319458 secs Fastest | |
Simple insert 4.95629596710205 secs 89% Slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
require 'bench_press' | |
extend BenchPress | |
author 'Erik Bryn' | |
summary 'Benchmark simple MySQL queries through ActiveRecord' | |
reps 1_000 | |
ActiveRecord::Base.establish_connection :adapter => "mysql", :database => "activerecord_unittest", :username => "root", :host => "127.0.0.1" | |
ActiveRecord::Schema.define do | |
create_table :test_benchmarks, :force => true do |t| | |
t.string :hello | |
end | |
end | |
class TestBenchmark < ActiveRecord::Base | |
end | |
measure "Simple find" do | |
TestBenchmark.find(:first) | |
end | |
measure "Simple insert" do | |
TestBenchmark.create :hello => "world" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
require 'bench_press' | |
extend BenchPress | |
author 'Erik Bryn' | |
summary 'Benchmark simple SQLite queries through ActiveRecord' | |
reps 1_000 | |
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => "benchmark.sqlite" | |
ActiveRecord::Schema.define do | |
create_table :test_benchmarks, :force => true do |t| | |
t.string :hello | |
end | |
end | |
class TestBenchmark < ActiveRecord::Base | |
end | |
measure "Simple find" do | |
TestBenchmark.find(:first) | |
end | |
measure "Simple insert" do | |
TestBenchmark.create :hello => "world" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
require 'bench_press' | |
$:.unshift File.expand_path('../../../lib',__FILE__) | |
extend BenchPress | |
author 'Erik Bryn' | |
summary 'Benchmark SQL Server Queries' | |
reps 1_000 | |
ActiveRecord::Base.establish_connection :adapter => "sqlserver", :dataserver => "sql2008", :username => "tinytds", :mode => 'dblib' | |
ActiveRecord::Schema.define do | |
create_table :test_benchmarks, :force => true do |t| | |
t.string :hello | |
end | |
end | |
class TestBenchmark < ActiveRecord::Base | |
end | |
measure "Simple find" do | |
TestBenchmark.find(:first) | |
end | |
measure "Simple insert" do | |
TestBenchmark.create :hello => "world" | |
end | |
measure "Raw find" do | |
TestBenchmark.connection.raw_connection.execute("SELECT TOP 1 * FROM test_benchmarks").each | |
end | |
measure "Raw insert" do | |
TestBenchmark.connection.raw_connection.execute("INSERT INTO test_benchmarks (hello) VALUES ('world')").each | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment