require 'rubygems' require 'sequel' require '../lib/oria' require 'benchmark' DB = Sequel.connect('mysql://root@localhost/oria_test') n = (ARGV.shift || 1000).to_i Benchmark.bm(15) do |bm| bm.report("MySQL (write):") do table = DB[:oria_test] n.times do if foo = table[:key => 'foo'] foo.update(:value => 'bar') else table.insert(:key => 'foo', :value => 'bar') end end end bm.report("Oria (write):") do n.times do Oria['foo'] = 'bar' end end bm.report("MySQL (read):") do table = DB[:oria_test] n.times do foo = table[:key => 'foo'] end end bm.report("Oria (read):") do n.times do foo = Oria['foo'] end end end