Created
November 22, 2011 14:59
-
-
Save ciaranarcher/1385852 to your computer and use it in GitHub Desktop.
AR Benchmark Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client < DatabaseSIA | |
# set a non-defualt primary key | |
set_primary_key :clientid | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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