Sha256: e17a9c241326d0ac37e16c7f4a657a4685904ca4b1e9a46aa68f2164430d3c87
Contents?: true
Size: 889 Bytes
Versions: 1
Compression:
Stored size: 889 Bytes
Contents
require "rubygems" require "bench" require File.dirname(__FILE__) + "/../lib/ohm" $redis = Redis.new(:port => 6381) $redis.flush_db class Event < Ohm::Model attribute :name set :attendees def validate assert_present :name end end event = Event.create(:name => "Ruby Tuesday") array = [] benchmark "redis add to set" do $redis.set_add("foo", 1) end benchmark "ohm add to set" do event.attendees << 1 end benchmark "ruby array push" do array.push(1) end $redis.set_add("bar", 1) $redis.set_add("bar", 2) benchmark "retrieve a set of two members" do $redis.set_members("bar") end benchmark "retrieve membership status and set count" do $redis.set_count("bar") $redis.set_member?("bar", "1") end benchmark "retrieve set count" do $redis.set_count("bar").zero? end benchmark "retrieve membership status" do $redis.set_member?("bar", "1") end run 20_000
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ohm-0.0.3 | test/benchmarks.rb |