Created
March 23, 2015 17:00
-
-
Save mckinnsb/2ac7298bf51093ea6961 to your computer and use it in GitHub Desktop.
Log Timings
This file contains 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 "spec_helper" | | |
require "benchmark" | | |
| | |
describe Api::V1::ProductsController do | | |
| | |
it "should be fairly performant", :performance => true, :js => true do | | |
| | |
@buyer = FactoryGirl.create :buyer, :complete | | |
login_as @buyer.user | | |
| | |
@seller = FactoryGirl.create :seller, :manhattan | | |
| | |
@products = FactoryGirl.create_list :product, | | |
10, | | |
:five_inventories, | | |
:seller => @seller | | |
| | |
results = [] | | |
| | |
#100.times do | | |
#result = Benchmark.realtime do | | |
visit api_v1_products_path( { :format => :json, :search => true } ) | | |
expect( page ).to have_content "long_name" | | |
#end | | |
#results.push result |< | |
#end | | |
|< | |
=begin | | |
average = results.inject(&:+) / results.size | | |
if defined? Oj | | |
puts "USING OJ" | | |
else | | |
puts "NOT USING OJ" | | |
end | | |
puts "AVERAGE SPEED #{average*1000}ms" | | |
puts "MAX: #{results.max*1000}ms" | | |
puts "MIN: #{results.min*1000}ms" | | |
=end | | |
| | |
end | | |
| | |
end |
This file contains 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
Feature Test: | |
Rendered api/v1/products/index.rabl (538.8ms) | |
Completed 200 OK in 651.0ms (Views: 485.7ms | ActiveRecord: 110.8ms) | |
Development Server ( with test options, such as cache classes: true ): | |
Rendered api/v1/products/index.rabl (1749.8ms) | |
Completed 200 OK in 2053.0ms (Views: 1644.6ms | ActiveRecord: 271.5ms) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment