alphagov/EFG — pull request #75 by benpickles (2012-10-31 16:24:08+00:00)
Title: Speed up loan report

Here's a quick benchmark script:

# benchmark.rb
require 'benchmark'
require 'csv'

loan_report = LoanReport.new
loan_report.lender_ids = [67] # Nominated lender from local training data.
loan_report.loan_sources = []

puts Benchmark.measure {
LoanReportCsvExport.new(loan_report.loans).generate
}

Run it like so:

$ git checkout master
$ ./script/rails runner benchmark.rb

6.780000 0.210000 6.990000 ( 8.034743)

$ git checkout speed-up-loan-report
$ ./script/rails runner benchmark.rb

2.430000 0.020000 2.450000 ( 2.634032)

https://www.pivotaltracker.com/story/show/34307221