Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created October 25, 2008 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/19642 to your computer and use it in GitHub Desktop.
Save josevalim/19642 to your computer and use it in GitHub Desktop.
# ab -n 1000 -c 5 localhost:3000/main/get_with_component
Requests per second: 51.04 [#/sec]
Time per request: 97.969 [ms]
# ab -n 1000 -c 5 localhost:3000/main/get_with_sibling
Requests per second: 57.35 [#/sec]
Time per request: 87.188 [ms]
# ab -n 1000 -c 5 localhost:3000/main/get_with_partial
Requests per second: 59.04 [#/sec]
Time per request: 84.688 [ms]
# Summary
Component Sibling Partial
Requests per second: 51.04 57.35 59.04
Time per request (ms): 97.969 87.188 84.688
# This is the benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/views/main/_sidebar_partial.html.erb
<p>Hi there!</p>
# This is a benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/views/main/get_with_component.html.erb
<p>Some fun content goes here</p>
<div class="sidebar">
<%= render_component(:action => 'sidebar') %>
</div>
# This is the benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/views/main/get_with_partial.html.erb
<p>Some fun content goes here</p>
<div class="sidebar">
<%= render :partial => 'main/sidebar_partial' %>
</div>
# This is the benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/views/main/get_with_sibling.html.erb
<p>Some fun content goes here</p>
<div class="sidebar">
<%= render_sibling('sidebar') %>
</div>
# This is a benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/controller/main_controller
class MainController < ApplicationController
layout false
def get_with_partial; end
def get_with_component; end
def get_with_sibling; end
def sidebar_partial; end
def sidebar; end
end
# This is the benchmark file for render_sibling_helper.rb available at:
# http://gist.github.com/19631
# app/views/main/sidebar.html.erb
<p>Hi there!</p>
# app/views/main/_sidebar_partial.html.erb
<p>Hi there!</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment