zilkey (owner)

Revisions

gist: 71275 Download_button fork
public
Public Clone URL: git://gist.github.com/71275.git
Embed All Files: show embed
erb_example_with_render_partial.html.erb #
1
2
3
4
5
6
7
8
# 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>
 
 
erector_example_with_widget_method.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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
stats_summary.txt #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
-------------------------------------------
  
  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)