Last active
August 29, 2015 14:01
-
-
Save tgxworld/6623ade403fe5d0ef1c5 to your computer and use it in GitHub Desktop.
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
# profile_test.rb | |
require 'abstract_unit' | |
require 'benchmark' | |
require 'benchmark/ips' | |
require 'ruby-prof' | |
class AController < ActionController::Base | |
def index | |
render html: 'ok' | |
end | |
end | |
class AControllerTest < ActionDispatch::IntegrationTest | |
def test_profile | |
get 'https://www.example.com/a/index' | |
assert_equal 'ok', response.body | |
end | |
end | |
Benchmark.ips(30) do |bm| | |
bm.report 'Fast' do | |
Minitest.run_one_method(AControllerTest, 'test_profile') | |
end | |
end | |
# Performance | |
guoxiang@guoxiang-GS60-2PC-Ghost actionpack (improve_performance_of_building_uri) $ for i in {1..3}; do ruby -Itest test/profile_test.rb; done | |
Calculating ------------------------------------- | |
Fast 95 i/100ms | |
------------------------------------------------- | |
Fast 979.5 (±7.6%) i/s - 29260 in 30.037629s | |
Calculating ------------------------------------- | |
Fast 94 i/100ms | |
------------------------------------------------- | |
Fast 973.5 (±7.7%) i/s - 29046 in 30.004998s | |
Calculating ------------------------------------- | |
Fast 93 i/100ms | |
------------------------------------------------- | |
Fast 970.6 (±8.1%) i/s - 28923 in 29.987609s | |
guoxiang@guoxiang-GS60-2PC-Ghost actionpack (improve_performance_of_building_uri) $ for i in {1..3}; do ruby -Itest test/profile_test.rb; done | |
Calculating ------------------------------------- | |
Slow 90 i/100ms | |
------------------------------------------------- | |
Slow 931.5 (±7.3%) i/s - 27810 in 30.007601s | |
Calculating ------------------------------------- | |
Slow 90 i/100ms | |
------------------------------------------------- | |
Slow 935.1 (±7.3%) i/s - 27900 in 29.988782s | |
Calculating ------------------------------------- | |
Slow 89 i/100ms | |
------------------------------------------------- | |
Slow 927.6 (±7.3%) i/s - 27679 in 29.996784s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment