Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.