Sha256: 154d091607fa44e60f7288e0e093154d0aac5802dacdf4cdc3df446b00ba10cd

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oria-0.1.1 benchmarks/mysql_v_oria.rb
oria-0.1.0 benchmarks/mysql_v_oria.rb
oria-0.0.3 benchmarks/sequel_v_oria.rb