Skip to content

Instantly share code, notes, and snippets.

@Guitaronin
Guitaronin / gist:efbeb9974dedda7d6486
Last active August 29, 2015 14:20
benchmark activerecord loading associations
require 'benchmark'
puts "loading..."
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require File.expand_path('../../config/environment', __FILE__)
puts "running..."
selections = ['source_id', 'campaign', 'sum(cost) as cost']
@Guitaronin
Guitaronin / orm_benchmark.rb
Created February 6, 2013 04:18
Attempting to benchmark popular rails ORMs performing a snippet of a task.
require 'benchmark'
require 'pp'
require 'active_record'
require 'sequel'
require 'data_mapper'
@start = Date.parse("2012-12-01")
@end = Date.parse("2012-12-31")
ActiveRecord::Base.establish_connection(adapter: 'mysql2', database: 'escobar_development', username: 'root', password: nil, pool: 5, timeout: 5000)