Skip to content

Commit

Permalink
Merge a26ea1d into 18f8fb8
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Oct 1, 2014
2 parents 18f8fb8 + a26ea1d commit 3da7dc5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Expand Up @@ -17,6 +17,8 @@ group :development do
gem 'pry-debugger', :platforms => [:mri_19, :mri_20]
gem 'pry-byebug', :platforms => [:mri_21]
gem 'rb-fsevent'
gem 'benchmark-ips'
gem 'memory_profiler'
end

group :test do
Expand Down
36 changes: 36 additions & 0 deletions Rakefile
Expand Up @@ -15,3 +15,39 @@ rescue LoadError
end

task :default => [:spec, :rubocop]


namespace :perf do
task :setup do
require 'omniauth'
require 'rack/test'
app = Rack::Builder.new do |b|
b.use Rack::Session::Cookie, :secret => 'abc123'
b.use OmniAuth::Strategies::Developer
b.run lambda { |_env| [200, {}, ['Not Found']] }
end.to_app
@app = Rack::MockRequest.new(app)

def call_app(path = ENV['GET_PATH'] || "/")
result = @app.get(path)
raise "Did not succeed #{result.body}" unless result.status == 200
result
end
end

task :ips => :setup do
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("ips") { call_app }
end
end

task :mem => :setup do
require 'memory_profiler'
num = Integer(ENV["CNT"] || 1)
report = MemoryProfiler.report do
num.times { call_app }
end
report.pretty_print
end
end

0 comments on commit 3da7dc5

Please sign in to comment.