Sha256: c41ae9d4b8a7f342bc9e884400fcda951b6485bf64e614d6ae31c3d44c6c3aae

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

require "rubygems"
require "bench"
require File.dirname(__FILE__) + "/../lib/ohm"

Ohm.connect(:port => 6381)
Ohm.flush

class Event < Ohm::Model
  attribute :name
  attribute :location

  index :name
  index :location

  def validate
    assert_present :name
    assert_present :location
  end
end

i = 0

benchmark "Create Events" do
  Event.create(:name => "Redis Meetup #{i}", :location => "London #{i}")
end

benchmark "Find by indexed attribute" do
  Event.find(:name => "Redis Meetup #{i}").first
end

benchmark "Mass update" do
  Event[1].update(:name => "Redis Meetup II")
end

benchmark "Load events" do
  Event[1].name
end

run 5000

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ohm-0.0.38 test/benchmarks.rb
ohm-0.0.37 test/benchmarks.rb
ohm-0.0.36 test/benchmarks.rb
ohm-0.0.35 test/benchmarks.rb