benchmark/og/bench.rb in nitro-0.10.0 vs benchmark/og/bench.rb in nitro-0.11.0
- old
+ new
@@ -1,15 +1,12 @@
# * George Moschovitis <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
-# $Id: bench.rb 255 2005-02-10 12:45:32Z gmosx $
+# $Id: bench.rb 263 2005-02-23 13:45:08Z gmosx $
-$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require 'og'; include Og
-require 'og'
-GC.disable
-
config = {
:adapter => 'sqlite',
:database => 'test',
:connection_count => 5
}
@@ -26,12 +23,12 @@
@hits = rand(5)
@rate = rand(100)
end
end
-Og::Database.drop_db!(config)
-db = Og::Database.new(config)
+Database.drop_db!(config)
+db = Database.new(config)
# Benchmark the insert speed. Useful for finding
# the improvement when using prepared statements.
articles = []
@@ -42,10 +39,12 @@
sum = 0
min = 999999
max = -min
+GC.disable
+
10.times do |i|
db.exec "DELETE FROM #{Article::DBTABLE}"
for article in articles
@@ -67,8 +66,10 @@
puts "Insert test #{i}: #{d} seconds"
end
-puts "Min: #{min}"
-puts "Max: #{max}"
-puts "Average: #{sum/10}"
+puts %{
+Min: #{min}
+Max: #{max}
+Average: #{sum/10}
+}