Created
October 15, 2010 21:40
-
-
Save syrnick/629001 to your computer and use it in GitHub Desktop.
Performance comparison between DM 1.0.2 and 0.10.0
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
Performance for lazy_load | |
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000336) | |
Save 100 times: 0.160000 0.010000 0.170000 ( 0.189396) | |
Get 100 times: 0.080000 0.000000 0.080000 ( 0.094426) | |
Get Text 100 times: 0.160000 0.010000 0.170000 ( 0.201173) | |
- should be great | |
Performance for json | |
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000350) | |
Save 100 times: 0.050000 0.010000 0.060000 ( 0.073780) | |
Get 100 times: 0.300000 0.010000 0.310000 ( 0.327668) | |
Get Text 100 times: 0.170000 0.000000 0.170000 ( 0.207645) | |
- should be snappy | |
Finished in 1.14364 seconds |
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
Performance for lazy_load | |
Instantiate 10000 times: 0.020000 0.000000 0.020000 ( 0.026950) | |
Save 10000 times: 6.870000 0.420000 7.290000 ( 8.799185) | |
Get 10000 times: 11.920000 0.450000 12.370000 ( 14.184978) | |
Get Text 10000 times: 30.560000 0.990000 31.550000 ( 34.841361) | |
- should be great | |
Performance for json | |
Instantiate 10000 times: 0.020000 0.000000 0.020000 ( 0.025346) | |
Save 10000 times: 6.820000 0.410000 7.230000 ( 8.785499) | |
Get 10000 times: 11.900000 0.440000 12.340000 ( 13.795785) | |
Get Text 10000 times: 30.880000 1.020000 31.900000 ( 35.523532) | |
- should be snappy | |
Finished in 117.172449 seconds |
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
Performance for lazy_load | |
Instantiate 10000 times: 0.010000 0.000000 0.010000 ( 0.008116) | |
Save 10000 times: 13.320000 0.560000 13.880000 ( 16.117759) | |
Get 10000 times: 11.620000 0.480000 12.100000 ( 13.705063) | |
Get Text 10000 times: 39.690000 1.290000 40.980000 ( 45.176585) | |
- should be great | |
Performance for json | |
Instantiate 10000 times: 0.010000 0.000000 0.010000 ( 0.007831) | |
Save 10000 times: 14.320000 0.590000 14.910000 ( 16.599648) | |
Get 10000 times: 11.630000 0.500000 12.130000 ( 14.421237) | |
Get Text 10000 times: 42.220000 1.370000 43.590000 ( 48.020809) | |
- should be snappy | |
Finished in 154.149738 seconds |
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
Performance for lazy_load | |
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000113) | |
Save 100 times: 0.200000 0.000000 0.200000 ( 0.218794) | |
Get 100 times: 0.060000 0.010000 0.070000 ( 0.088571) | |
Get Text 100 times: 0.350000 0.010000 0.360000 ( 0.389551) | |
- should be great | |
Performance for json | |
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000104) | |
Save 100 times: 0.320000 0.010000 0.330000 ( 0.346145) | |
Get 100 times: 0.070000 0.010000 0.080000 ( 0.084491) | |
Get Text 100 times: 0.460000 0.010000 0.470000 ( 0.517812) | |
- should be snappy | |
Finished in 1.734221 seconds |
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
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')) | |
require 'benchmark' | |
num_iters = 100 | |
describe "Performance for lazy_load" do | |
it "should be great" do | |
class FunnyJoke | |
include DataMapper::Resource | |
property :id, Serial | |
property :punchline, Text | |
end | |
FunnyJoke.repository.adapter.execute(<<SQL) | |
CREATE TABLE funny_jokes | |
( id serial NOT NULL, | |
punchline character varying(65535) DEFAULT NULL::character varying, | |
CONSTRAINT funny_jokes_pkey PRIMARY KEY (id) | |
); | |
SQL | |
instantiate_bench = Benchmark.measure do | |
num_iters.times do |i| | |
joke = FunnyJoke.new | |
end | |
end | |
joke_ids =[] | |
save_bench = Benchmark.measure do | |
num_iters.times do |i| | |
joke = FunnyJoke.new | |
joke.punchline = "#{i} is funny" | |
joke.save | |
joke_ids << joke.id | |
end | |
end | |
retrieve_bench = Benchmark.measure do | |
joke_ids.each do |id| | |
joke = FunnyJoke.get(id) | |
end | |
end | |
retrieve_bench_2 = Benchmark.measure do | |
joke_ids.each do |id| | |
joke = FunnyJoke.get(id) | |
p = joke.punchline | |
end | |
end | |
puts "Instantiate #{num_iters} times: #{instantiate_bench}" | |
puts "Save #{num_iters} times: #{save_bench}" | |
puts "Get #{num_iters} times: #{retrieve_bench}" | |
puts "Get Text #{num_iters} times: #{retrieve_bench_2}" | |
end | |
end | |
describe "Performance for json" do | |
it "should be snappy" do | |
class AnotherFunnyJoke | |
include DataMapper::Resource | |
property :id, Serial | |
property :fancy_punchline, Json | |
end | |
AnotherFunnyJoke.repository.adapter.execute(<<SQL) | |
CREATE TABLE another_funny_jokes | |
( id serial NOT NULL, | |
fancy_punchline character varying(65535) DEFAULT NULL::character varying, | |
CONSTRAINT another_funny_jokes_pkey PRIMARY KEY (id) | |
); | |
SQL | |
instantiate_bench = Benchmark.measure do | |
num_iters.times do |i| | |
joke = AnotherFunnyJoke.new | |
end | |
end | |
joke_ids =[] | |
save_bench = Benchmark.measure do | |
num_iters.times do |i| | |
joke = AnotherFunnyJoke.new | |
joke.fancy_punchline = { "stuff" => "is funny" } | |
joke.save | |
joke_ids << joke.id | |
end | |
end | |
retrieve_bench = Benchmark.measure do | |
joke_ids.each do |id| | |
joke = AnotherFunnyJoke.get(id) | |
end | |
end | |
retrieve_bench_2 = Benchmark.measure do | |
joke_ids.each do |id| | |
joke = AnotherFunnyJoke.get(id) | |
p = joke.fancy_punchline | |
end | |
end | |
puts "Instantiate #{num_iters} times: #{instantiate_bench}" | |
puts "Save #{num_iters} times: #{save_bench}" | |
puts "Get #{num_iters} times: #{retrieve_bench}" | |
puts "Get Text #{num_iters} times: #{retrieve_bench_2}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment