Skip to content

Instantly share code, notes, and snippets.

@tgxworld
Last active August 29, 2015 14:02
Show Gist options
  • Save tgxworld/c1641dd18bea614ca216 to your computer and use it in GitHub Desktop.
Save tgxworld/c1641dd18bea614ca216 to your computer and use it in GitHub Desktop.
Notifications
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
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(AController1Test, 'test_profile')
end
end
# Performance
Calculating -------------------------------------
Fast 96 i/100ms
-------------------------------------------------
Fast 1000.9 (±10.1%) i/s - 29760 in 30.037473s
Calculating -------------------------------------
Fast 96 i/100ms
-------------------------------------------------
Fast 998.6 (±10.1%) i/s - 29664 in 30.011666s
Calculating -------------------------------------
Fast 96 i/100ms
-------------------------------------------------
Fast 1005.4 (±10.1%) i/s - 29856 in 30.004645s
Calculating -------------------------------------
Slow 93 i/100ms
-------------------------------------------------
Slow 972.9 (±10.9%) i/s - 28830 in 29.993642s
Calculating -------------------------------------
Slow 94 i/100ms
-------------------------------------------------
Slow 971.1 (±11.4%) i/s - 28764 in 30.017974s
Calculating -------------------------------------
Slow 93 i/100ms
-------------------------------------------------
Slow 971.6 (±11.0%) i/s - 28830 in 30.039329s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment