Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b57d94c1
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b57d94c1
编写于
8月 08, 2009
作者:
Y
Yehuda Katz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update minimal.rb to benchmark partials
上级
d7415f79
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
5 deletion
+50
-5
actionpack/examples/minimal.rb
actionpack/examples/minimal.rb
+27
-4
actionpack/examples/views/_collection.erb
actionpack/examples/views/_collection.erb
+1
-0
actionpack/examples/views/_hello.erb
actionpack/examples/views/_hello.erb
+1
-0
actionpack/examples/views/_many_partials.erb
actionpack/examples/views/_many_partials.erb
+10
-0
actionpack/examples/views/_partial.erb
actionpack/examples/views/_partial.erb
+10
-0
actionpack/examples/views/template.html.erb
actionpack/examples/views/template.html.erb
+1
-1
未找到文件。
actionpack/examples/minimal.rb
浏览文件 @
b57d94c1
...
...
@@ -3,6 +3,7 @@
ENV
[
'NO_RELOAD'
]
||=
'1'
$LOAD_PATH
.
unshift
"
#{
File
.
dirname
(
__FILE__
)
}
/../lib"
$LOAD_PATH
.
unshift
"
#{
File
.
dirname
(
__FILE__
)
}
/../../activesupport/lib"
require
'action_controller'
require
'action_controller/new_base'
if
ENV
[
'NEW'
]
require
'benchmark'
...
...
@@ -26,7 +27,7 @@ def report(env, response)
def
self
.
run
(
app
,
n
,
label
=
nil
)
puts
'='
*
label
.
size
,
label
,
'='
*
label
.
size
if
label
env
=
{
'n'
=>
n
,
'rack.input'
=>
StringIO
.
new
(
''
),
'rack.errors'
=>
$stdout
}
env
=
Rack
::
MockRequest
.
env_for
(
"/"
).
merge
(
'n'
=>
n
,
'rack.input'
=>
StringIO
.
new
(
''
),
'rack.errors'
=>
$stdout
)
t
=
Benchmark
.
realtime
{
new
(
app
).
call
(
env
)
}
puts
"%d ms / %d req = %.1f usec/req"
%
[
10
**
3
*
t
,
n
,
10
**
6
*
t
/
n
]
puts
...
...
@@ -37,9 +38,27 @@ def self.run(app, n, label = nil)
N
=
(
ENV
[
'N'
]
||
1000
).
to_i
class
BasePostController
<
ActionController
::
Base
append_view_path
"
#{
File
.
dirname
(
__FILE__
)
}
/views"
def
index
render
:text
=>
''
end
def
partial
render
:partial
=>
"/partial"
end
def
many_partials
render
:partial
=>
"/many_partials"
end
def
partial_collection
render
:partial
=>
"/collection"
,
:collection
=>
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
end
def
show_template
render
:template
=>
"template"
end
end
OK
=
[
200
,
{},
[]]
...
...
@@ -51,6 +70,10 @@ def index
end
end
Runner
.
run
(
MetalPostController
,
N
,
'metal'
)
Runner
.
run
(
HttpPostController
.
action
(
:index
),
N
,
'http'
)
if
defined?
HttpPostController
Runner
.
run
(
BasePostController
.
action
(
:index
),
N
,
'base'
)
# Runner.run(MetalPostController, N, 'metal')
# Runner.run(HttpPostController.action(:index), N, 'http') if defined? HttpPostController
# Runner.run(BasePostController.action(:index), N, 'base')
Runner
.
run
(
BasePostController
.
action
(
:partial
),
N
,
'partial'
)
Runner
.
run
(
BasePostController
.
action
(
:many_partials
),
N
,
'many_partials'
)
Runner
.
run
(
BasePostController
.
action
(
:partial_collection
),
N
,
'collection'
)
Runner
.
run
(
BasePostController
.
action
(
:show_template
),
N
,
'template'
)
actionpack/examples/views/_collection.erb
0 → 100644
浏览文件 @
b57d94c1
<%=
collection
%>
\ No newline at end of file
actionpack/examples/views/_hello.erb
0 → 100644
浏览文件 @
b57d94c1
Hello
\ No newline at end of file
actionpack/examples/views/_many_partials.erb
0 → 100644
浏览文件 @
b57d94c1
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
<%=
render
:partial
=>
'/hello'
%>
\ No newline at end of file
actionpack/examples/views/_partial.erb
0 → 100644
浏览文件 @
b57d94c1
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
<%=
"Hello"
%>
actionpack/examples/views/template.html.erb
浏览文件 @
b57d94c1
Hello
<%=
@name
%>
\ No newline at end of file
Hello
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录