Sha256: daa0e7dd2ff29699ecd47184ed7fc89bb1aba91fb198c06dbf823345afb045aa

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require File.expand_path('../lib/dm-adapter-simpledb', File.dirname(__FILE__))
require 'logger'

include DataMapper

class Post
  include Resource
  
  property :title, String, :key => true
  property :body,  Text
end

logger = ::Logger.new($stderr, ::Logger::DEBUG)

DataMapper.setup(
  :default,
  :domain        => "dm_simpledb_adapter_benchmark",
  :adapter       => 'simpledb',
  :create_domain => true,
  :logger        => logger)

logger.info "Writing records"
100.times do |i|
  Post.create(:title => "title#{i}", :body => "body#{i}")
end

logger.info "Waiting a bit for consistency"
sleep 2

logger.info "benchmarking OR"
SDBTools::Transaction.on_close = 
  SDBTools::Transaction.log_transaction_close(logger)
SDBTools::Transaction.open("benchmark OR") do |t|
  query      = Post.all(:title.like => "%2%") | Post.all(:title.like => "%5%")
  item_count = query.to_a.size
  logger.info "Found #{item_count} items"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-adapter-simpledb-1.5.0 scripts/union_benchmark
dm-adapter-simpledb-1.4.0 scripts/union_benchmark