Skip to content

Instantly share code, notes, and snippets.

@ciaranarcher
Created November 22, 2011 14:59
Show Gist options
  • Save ciaranarcher/1385852 to your computer and use it in GitHub Desktop.
Save ciaranarcher/1385852 to your computer and use it in GitHub Desktop.
AR Benchmark Example
class Client < DatabaseSIA
# set a non-defualt primary key
set_primary_key :clientid
end
get "/all" do
@total_time = Benchmark.realtime do
@clients = Client.where("clientID > 0")
@clients.each do |client|
puts client.ClientID
end
end
puts "done in #{@total_time}"
"done in #{@total_time}"
end
#require "active_record"
class DatabaseSIA < ActiveRecord::Base
self.abstract_class = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment