Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
8c7416b3
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c7416b3
编写于
9月 25, 2018
作者:
K
Kevin (Kun) "Kassimo" Qian
提交者:
Ryan Dahl
9月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Expand binary size benchmark (#830)
上级
591174a6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
14 deletion
+71
-14
tools/benchmark.py
tools/benchmark.py
+18
-7
tools/benchmark_test.py
tools/benchmark_test.py
+10
-1
tools/test.py
tools/test.py
+1
-1
website/app.js
website/app.js
+16
-1
website/app_test.js
website/app_test.js
+26
-4
未找到文件。
tools/benchmark.py
浏览文件 @
8c7416b3
...
...
@@ -10,15 +10,10 @@ import sys
import
json
import
time
import
shutil
from
util
import
run
,
run_output
,
root_path
,
build_path
from
util
import
run
,
run_output
,
root_path
,
build_path
,
executable_suffix
import
tempfile
import
http_server
try
:
http_server
.
spawn
()
except
:
"Warning: another http_server instance is running"
# The list of the tuples of the benchmark name and arguments
exec_time_benchmarks
=
[
(
"hello"
,
[
"tests/002_hello.ts"
]),
...
...
@@ -54,6 +49,19 @@ def import_data_from_gh_pages():
write_json
(
data_file
,
[])
# writes empty json data
def
get_binary_sizes
(
build_dir
):
path_dict
=
{
"deno"
:
os
.
path
.
join
(
build_dir
,
"deno"
+
executable_suffix
),
"main.js"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js"
),
"main.js.map"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js.map"
),
"snapshot_deno.bin"
:
os
.
path
.
join
(
build_dir
,
"gen/snapshot_deno.bin"
)
}
sizes
=
{}
for
name
,
path
in
path_dict
.
items
():
sizes
[
name
]
=
os
.
path
.
getsize
(
path
)
return
sizes
def
get_strace_summary_text
(
test_args
):
f
=
tempfile
.
NamedTemporaryFile
()
run
([
"strace"
,
"-c"
,
"-f"
,
"-o"
,
f
.
name
]
+
test_args
)
...
...
@@ -124,6 +132,8 @@ def main(argv):
print
"Usage: tools/benchmark.py [build_dir]"
sys
.
exit
(
1
)
http_server
.
spawn
()
deno_path
=
os
.
path
.
join
(
build_dir
,
"deno"
)
benchmark_file
=
os
.
path
.
join
(
build_dir
,
"benchmark.json"
)
...
...
@@ -139,7 +149,7 @@ def main(argv):
new_data
=
{
"created_at"
:
time
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
),
"sha1"
:
sha1
,
"binary_size"
:
os
.
path
.
getsize
(
deno_path
)
,
"binary_size"
:
{}
,
"thread_count"
:
{},
"syscall_count"
:
{},
"benchmark"
:
{}
...
...
@@ -155,6 +165,7 @@ def main(argv):
"max"
:
data
[
"max"
]
}
new_data
[
"binary_size"
]
=
get_binary_sizes
(
build_dir
)
if
"linux"
in
sys
.
platform
:
# Thread count test, only on linux
new_data
[
"thread_count"
]
=
run_thread_count_benchmark
(
deno_path
)
...
...
tools/benchmark_test.py
浏览文件 @
8c7416b3
...
...
@@ -19,6 +19,14 @@ def strace_parse_test():
assert
summary
[
"total"
][
"calls"
]
==
704
def
binary_size_test
(
build_dir
):
binary_size_dict
=
benchmark
.
get_binary_sizes
(
build_dir
)
assert
binary_size_dict
[
"deno"
]
>
0
assert
binary_size_dict
[
"main.js"
]
>
0
assert
binary_size_dict
[
"main.js.map"
]
>
0
assert
binary_size_dict
[
"snapshot_deno.bin"
]
>
0
def
thread_count_test
(
deno_path
):
thread_count_dict
=
benchmark
.
run_thread_count_benchmark
(
deno_path
)
assert
"set_timeout"
in
thread_count_dict
...
...
@@ -31,8 +39,9 @@ def syscall_count_test(deno_path):
assert
syscall_count_dict
[
"hello"
]
>
1
def
benchmark_test
(
deno_path
):
def
benchmark_test
(
build_dir
,
deno_path
):
strace_parse_test
()
binary_size_test
(
build_dir
)
if
"linux"
in
sys
.
platform
:
thread_count_test
(
deno_path
)
syscall_count_test
(
deno_path
)
tools/test.py
浏览文件 @
8c7416b3
...
...
@@ -41,7 +41,7 @@ def main(argv):
# Internal tools testing
setup_test
()
util_test
()
benchmark_test
(
deno_exe
)
benchmark_test
(
build_dir
,
deno_exe
)
test_cc
=
os
.
path
.
join
(
build_dir
,
"test_cc"
+
executable_suffix
)
check_exists
(
test_cc
)
...
...
website/app.js
浏览文件 @
8c7416b3
...
...
@@ -21,8 +21,23 @@ export function createExecTimeColumns(data) {
]);
}
const
binarySizeNames
=
[
"
deno
"
,
"
main.js
"
,
"
main.js.map
"
,
"
snapshot_deno.bin
"
];
export
function
createBinarySizeColumns
(
data
)
{
return
[[
"
binary_size
"
,
...
data
.
map
(
d
=>
d
.
binary_size
||
0
)]];
return
binarySizeNames
.
map
(
name
=>
[
name
,
...
data
.
map
(
d
=>
{
const
binarySizeData
=
d
[
"
binary_size
"
];
switch
(
typeof
binarySizeData
)
{
case
"
number
"
:
// legacy implementation
return
name
===
"
deno
"
?
binarySizeData
:
0
;
default
:
if
(
!
binarySizeData
)
{
return
0
;
}
return
binarySizeData
[
name
]
||
0
;
}
})
]);
}
const
threadCountNames
=
[
"
set_timeout
"
,
"
fetch_deps
"
];
...
...
website/app_test.js
浏览文件 @
8c7416b3
...
...
@@ -14,7 +14,12 @@ const regularData = [
{
created_at
:
"
2018-01-01T01:00:00Z
"
,
sha1
:
"
abcdef
"
,
binary_size
:
100000000
,
binary_size
:
{
deno
:
100000000
,
"
main.js
"
:
90000000
,
"
main.js.map
"
:
80000000
,
"
snapshot_deno.bin
"
:
70000000
},
benchmark
:
{
hello
:
{
mean
:
0.05
...
...
@@ -40,7 +45,12 @@ const regularData = [
{
created_at
:
"
2018-01-02T01:00:00Z
"
,
sha1
:
"
012345
"
,
binary_size
:
110000000
,
binary_size
:
{
deno
:
100000001
,
"
main.js
"
:
90000001
,
"
main.js.map
"
:
80000001
,
"
snapshot_deno.bin
"
:
70000001
},
benchmark
:
{
hello
:
{
mean
:
0.055
...
...
@@ -69,6 +79,7 @@ const irregularData = [
{
created_at
:
"
2018-01-01T01:00:00Z
"
,
sha1
:
"
123
"
,
binary_size
:
{},
benchmark
:
{
hello
:
{},
relative_import
:
{},
...
...
@@ -81,6 +92,7 @@ const irregularData = [
{
created_at
:
"
2018-02-01T01:00:00Z
"
,
sha1
:
"
456
"
,
binary_size
:
100000000
,
benchmark
:
{}
}
];
...
...
@@ -107,12 +119,22 @@ test(function createExecTimeColumnsIrregularData() {
test
(
function
createBinarySizeColumnsRegularData
()
{
const
columns
=
createBinarySizeColumns
(
regularData
);
assertEqual
(
columns
,
[[
"
binary_size
"
,
100000000
,
110000000
]]);
assertEqual
(
columns
,
[
[
"
deno
"
,
100000000
,
100000001
],
[
"
main.js
"
,
90000000
,
90000001
],
[
"
main.js.map
"
,
80000000
,
80000001
],
[
"
snapshot_deno.bin
"
,
70000000
,
70000001
]
]);
});
test
(
function
createBinarySizeColumnsIrregularData
()
{
const
columns
=
createBinarySizeColumns
(
irregularData
);
assertEqual
(
columns
,
[[
"
binary_size
"
,
0
,
0
]]);
assertEqual
(
columns
,
[
[
"
deno
"
,
0
,
100000000
],
[
"
main.js
"
,
0
,
0
],
[
"
main.js.map
"
,
0
,
0
],
[
"
snapshot_deno.bin
"
,
0
,
0
]
]);
});
test
(
function
createThreadCountColumnsRegularData
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录