Created
January 4, 2010 13:37
-
-
Save ihower/268512 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# This is not serious benchmark, you should read: | |
# | |
# http://jan.prima.de/plok/archives/175-Benchmarks-You-are-Doing-it-Wrong.html | |
# http://jan.prima.de/plok/archives/176-Benchmarks-You-are-Doing-it-Wrong.html | |
# http://books.couchdb.org/relax/reference/high-performance | |
# | |
# CouchDB v0.10.0 (via CouchDBX) on Macbook Pro 2.2 (Snow Leopard) | |
# | |
# 1000 times | |
# Round 1 | |
# 1.320000 0.180000 1.500000 ( 6.624501) - Write | |
# 1.160000 0.160000 1.320000 ( 4.057177) - Read | |
# Round 2 | |
# 1.330000 0.200000 1.530000 ( 6.843506) - Write | |
# 1.160000 0.160000 1.320000 ( 4.211104) - Read | |
# | |
# 10000 times | |
# 13.620000 1.850000 15.470000 ( 75.547215) - Write | |
# 12.070000 1.640000 13.710000 ( 44.341268) - Read | |
require 'rubygems' | |
require 'benchmark' | |
require 'couchrest' | |
DB = CouchRest.database!("http://127.0.0.1:5984/couchrest_bm") | |
class Person < CouchRest::ExtendedDocument | |
use_database DB | |
property :first_name, :type => String | |
property :last_name, :type => String | |
property :age, :type => Integer | |
end | |
array = [] | |
write_bm = Benchmark.measure do | |
10000.times { |i| array << Person.create( :first_name => "aaa", :last_name => "bbb", :age => i ).id } | |
end | |
read_bm = Benchmark.measure do | |
array.each { |id| Person.get(id) } | |
end | |
puts write_bm | |
puts read_bm |
This file contains hidden or 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
# MongoDB v1.2.1 (via MacPorts) on Macbook Pro 2.2 (Snow Leopard) | |
# | |
# 1000 times | |
# Round 1 | |
# 0.680000 0.030000 0.710000 ( 0.711240) - Write | |
# 0.690000 0.040000 0.730000 ( 0.831395) - Read | |
# Round 2 | |
# 0.680000 0.030000 0.710000 ( 0.709169) - Write | |
# 0.690000 0.040000 0.730000 ( 0.831326) - Read | |
# 10000 times | |
# Round 1 | |
# 7.190000 0.210000 7.400000 ( 7.507419) - Write | |
# 7.210000 0.340000 7.550000 ( 8.579526) - Read | |
# Round 2 | |
# 7.190000 0.210000 7.400000 ( 7.477539) - Write | |
# 7.420000 0.370000 7.790000 ( 9.028373) - Read | |
require 'rubygems' | |
require 'benchmark' | |
require 'mongo_mapper' | |
MongoMapper.database = "bm" | |
class Person | |
include MongoMapper::Document | |
key :first_name, String | |
key :last_name, String | |
key :age, Integer | |
end | |
array = [] | |
write_bm = Benchmark.measure do | |
10000.times { |i| array << Person.create( :first_name => "aaa", :last_name => "bbb", :age => i ).id } | |
end | |
read_bm = Benchmark.measure do | |
array.each { |id| Person.find(id) } | |
end | |
puts write_bm | |
puts read_bm |
This file contains hidden or 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
# MySQL 5.1 (via package) on Macbook Pro 2.2 (Snow Leopard) | |
# | |
# 1000 times | |
# Round 1 | |
# 0.210000 0.030000 0.240000 ( 0.326423) - Write | |
# 0.300000 0.030000 0.330000 ( 0.478704) - Read | |
# Round 2 | |
# 0.210000 0.030000 0.240000 ( 0.325020) - Write | |
# 0.300000 0.030000 0.330000 ( 0.480886) - Read | |
# | |
# 10000 times | |
# Round 1 | |
# 2.120000 0.260000 2.380000 ( 3.322318) - Write | |
# 2.940000 0.330000 3.270000 ( 4.741207) - Read | |
# Round 2 | |
# 2.140000 0.270000 2.410000 ( 3.398455) - Write | |
# 2.970000 0.350000 3.320000 ( 4.873117) - Read | |
require "rubygems" | |
require 'benchmark' | |
require "sequel" | |
DB = Sequel.connect('mysql://root:@localhost/bm') | |
#DB.create_table :people do | |
# primary_key :id | |
# String :first_name | |
# String :last_name | |
# Integer :age | |
#end | |
Person = DB[:people] | |
array = [] | |
write_bm = Benchmark.measure do | |
10000.times { |i| array << Person.insert( :first_name => "aaa", :last_name => "bbb", :age => i ) } | |
end | |
read_bm = Benchmark.measure do | |
array.each { |id| Person[:id=>id] } | |
end | |
puts write_bm | |
puts read_bm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment