-
-
Save solnic/807464 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
require 'rubygems' | |
gem 'dm-core', '0.10.2' | |
gem 'dm-migrations', '0.10.2' | |
gem 'dm-timestamps', '0.10.2' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'dm-timestamps' | |
require 'dm-migrations/migration_runner' | |
require 'benchmark' | |
DataMapper.setup(:default, 'sqlite3::memory') # createdb test | |
class Course | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, String | |
has n, :exams | |
end | |
class Exam | |
include DataMapper::Resource | |
property :id, Serial | |
belongs_to :course | |
end | |
#DataMapper.finalize | |
DataMapper.auto_migrate! | |
Benchmark.bm do |x| | |
x.report do | |
1000.times do |i| | |
course = Course.create(:name =>"Ruby #{i}") | |
Exam.create(:course => course) | |
end | |
end | |
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
DM 0.10.2: | |
user system total real | |
4.250000 1.130000 5.380000 ( 36.003685) | |
DM master (02/02/2011): | |
user system total real | |
6.850000 1.150000 8.000000 ( 36.257449) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment