Skip to content

Instantly share code, notes, and snippets.

@zilkey
Created February 27, 2009 03:54
Show Gist options
  • Save zilkey/71275 to your computer and use it in GitHub Desktop.
Save zilkey/71275 to your computer and use it in GitHub Desktop.
# app/views/hellos/erb.html.erb
# note the leading spaces - this makes it exactly the same number of bytes that erector outputs
<%- 1000.times do -%><%= render :partial => "simple" %><%- end -%>
# app/views/hellos/_simple.html.erb
<p><%= "hello world" %></p>
# app/views/hellos/erector.rb
class Views::Hellos::Erector < Erector::Widget
def render
1000.times do
widget Views::Hellos::Simple
end
end
end
# app/views/hellos/simple.rb
class Views::Hellos::Simple < Erector::Widget
def render
p "hello world"
end
end
-------------------------------------------
1000 paragraph tags, rendered inline
-------------------------------------------
Document Path: /hellos/erb
Document Length: 18009 bytes
Concurrency Level: 1
Time taken for tests: 5.488109 seconds
Complete requests: 1000
Total transferred: 18476008 bytes
HTML transferred: 18009000 bytes
Requests per second: 182.21 [#/sec] (mean)
Time per request: 5.488 [ms] (mean)
Time per request: 5.488 [ms] (mean, across all concurrent requests)
Transfer rate: 3287.47 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
100% 102 (longest request)
---
Document Path: /hellos/erector
Document Length: 18009 bytes
Time taken for tests: 22.408021 seconds
Complete requests: 1000
Total transferred: 18477023 bytes
HTML transferred: 18009000 bytes
Requests per second: 44.63 [#/sec] (mean)
Time per request: 22.408 [ms] (mean)
Time per request: 22.408 [ms] (mean, across all concurrent requests)
Transfer rate: 805.20 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
125 (longest request)
-------------------------------------------
1000 paragraph tags, rendered with partials or widgets
-------------------------------------------
Document Path: /hellos/erb
Document Length: 18009 bytes
Time taken for tests: 95.200031 seconds
Complete requests: 1000
Total transferred: 18477215 bytes
HTML transferred: 18009000 bytes
Requests per second: 10.50 [#/sec] (mean)
Time per request: 95.200 [ms] (mean)
Time per request: 95.200 [ms] (mean, across all concurrent requests)
Transfer rate: 189.54 [Kbytes/sec] received
242 (longest request)
---
Document Path: /hellos/erector
Document Length: 18009 bytes
Time taken for tests: 37.735180 seconds
Complete requests: 1000
Total transferred: 18477055 bytes
HTML transferred: 18009000 bytes
Requests per second: 26.50 [#/sec] (mean)
Time per request: 37.735 [ms] (mean)
Time per request: 37.735 [ms] (mean, across all concurrent requests)
Transfer rate: 478.15 [Kbytes/sec] received
167 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment