Skip to content

Instantly share code, notes, and snippets.

@tgxworld
Created May 31, 2014 21:02
Show Gist options
  • Save tgxworld/c65672a5214182abef36 to your computer and use it in GitHub Desktop.
Save tgxworld/c65672a5214182abef36 to your computer and use it in GitHub Desktop.
require 'abstract_unit'
require 'benchmark/ips'
require 'ruby-prof'
class AController < ActionController::Base
def index
render html: 'ok'
end
end
class AController1Test < ActionDispatch::IntegrationTest
def test_profile
head 'https://www.example.com/a/index'
assert_equal "", response.body
end
end
Benchmark.ips(30) do |bm|
bm.report 'Fast' do
Minitest.run_one_method(AController1Test, 'test_profile')
end
end
# Performance
Calculating -------------------------------------
Slow 84 i/100ms
-------------------------------------------------
Slow 887.1 (±13.9%) i/s - 26124 in 30.035717s
Calculating -------------------------------------
Slow 84 i/100ms
-------------------------------------------------
Slow 899.9 (±13.4%) i/s - 26544 in 30.036576s
Calculating -------------------------------------
Slow 82 i/100ms
-------------------------------------------------
Slow 917.1 (±16.2%) i/s - 26732 in 29.995072s
Calculating -------------------------------------
Fast 93 i/100ms
-------------------------------------------------
Fast 954.3 (±16.6%) i/s - 27807 in 30.014775s
Calculating -------------------------------------
Fast 90 i/100ms
-------------------------------------------------
Fast 958.2 (±16.3%) i/s - 27900 in 29.984117s
Calculating -------------------------------------
Fast 90 i/100ms
-------------------------------------------------
Fast 925.3 (±17.7%) i/s - 26910 in 30.093053s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment