require 'rubygems' require 'sequel' require '../lib/oria' require 'benchmark' DB = Sequel.sqlite DB.create_table :oria_test do primary_key :id String :key String :value end n = (ARGV.shift || 1000).to_i Benchmark.bm(16) do |bm| bm.report("SQLite3 (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("SQLite3 (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