Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created July 10, 2014 08:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujimura/f4b4146da2f552ba81ed to your computer and use it in GitHub Desktop.
Save fujimura/f4b4146da2f552ba81ed to your computer and use it in GitHub Desktop.
Idea of RSpec-ish benchmarking tool
require 'benchmark_helper'
# Describe performance like RSpec-ish DSL
describe Api::Notifications do
before do
# Can use FactoryGirl to populate data
@me = create :user
create :post, author: @user
1000.times do
user = create :user
@me.subscribe! user
create :post, author: user
end
end
# Block run within #benchmark will be measured
benchmark "Receiving notification" do
get '/notifications'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment