Sha256: 306418495dc7d0d2404c34b89bd5640acf134ddc79d8a1711a837622dc8cbe0e

Contents?: true

Size: 775 Bytes

Versions: 3

Compression:

Stored size: 775 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oria-0.1.1 benchmarks/sqlite_v_oria.rb
oria-0.1.0 benchmarks/sqlite_v_oria.rb
oria-0.0.3 benchmarks/sqlite_v_oria.rb