Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
c814d5a9
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,发现更多精彩内容 >>
未验证
提交
c814d5a9
编写于
10月 11, 2018
作者:
R
Ryan Dahl
提交者:
GitHub
10月 11, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add throughput benchmark (#961)
上级
51f9331e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
145 addition
and
7 deletion
+145
-7
tests/echo_server.ts
tests/echo_server.ts
+9
-0
tools/benchmark.py
tools/benchmark.py
+14
-0
tools/throughput_benchmark.py
tools/throughput_benchmark.py
+54
-0
website/app.js
website/app.js
+49
-7
website/app_test.js
website/app_test.js
+16
-0
website/index.html
website/index.html
+3
-0
未找到文件。
tests/echo_server.ts
0 → 100644
浏览文件 @
c814d5a9
import
{
args
,
listen
,
copy
}
from
"
deno
"
;
const
addr
=
args
[
1
]
||
"
127.0.0.1:4544
"
;
const
listener
=
listen
(
"
tcp
"
,
addr
);
console
.
log
(
"
listening on
"
,
addr
);
listener
.
accept
().
then
(
async
conn
=>
{
await
copy
(
conn
,
conn
);
conn
.
close
();
listener
.
close
();
});
tools/benchmark.py
浏览文件 @
c814d5a9
...
...
@@ -13,6 +13,7 @@ import shutil
from
util
import
run
,
run_output
,
root_path
,
build_path
,
executable_suffix
import
tempfile
import
http_server
import
throughput_benchmark
# The list of the tuples of the benchmark name and arguments
exec_time_benchmarks
=
[
...
...
@@ -116,6 +117,15 @@ def run_thread_count_benchmark(deno_path):
return
thread_count_map
def
run_throughput
(
deno_exe
):
m
=
{}
m
[
"100M_tcp"
]
=
throughput_benchmark
.
tcp
(
deno_exe
,
100
)
m
[
"100M_cat"
]
=
throughput_benchmark
.
cat
(
deno_exe
,
100
)
m
[
"10M_tcp"
]
=
throughput_benchmark
.
tcp
(
deno_exe
,
10
)
m
[
"10M_cat"
]
=
throughput_benchmark
.
cat
(
deno_exe
,
10
)
return
m
def
run_syscall_count_benchmark
(
deno_path
):
syscall_count_map
=
{}
syscall_count_map
[
"hello"
]
=
get_strace_summary
(
...
...
@@ -169,6 +179,10 @@ def main(argv):
}
new_data
[
"binary_size"
]
=
get_binary_sizes
(
build_dir
)
# Cannot run throughput benchmark on windows because they don't have nc or
# pipe.
if
os
.
name
!=
'nt'
:
new_data
[
"throughput"
]
=
run_throughput
(
deno_path
)
if
"linux"
in
sys
.
platform
:
# Thread count test, only on linux
new_data
[
"thread_count"
]
=
run_thread_count_benchmark
(
deno_path
)
...
...
tools/throughput_benchmark.py
0 → 100755
浏览文件 @
c814d5a9
#!/usr/bin/env python
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
# Performs benchmark and append data to //website/data.json.
# If //website/data.json doesn't exist, this script tries to import it from gh-pages branch.
# To view the results locally run ./tools/http_server.py and visit
# http://localhost:4545/website
import
os
import
sys
import
util
import
time
import
subprocess
MB
=
1024
*
1024
ADDR
=
"127.0.0.1:4544"
def
cat
(
deno_exe
,
megs
):
size
=
megs
*
MB
start
=
time
.
time
()
cmd
=
deno_exe
+
" tests/cat.ts /dev/zero | head -c %s "
%
size
print
cmd
subprocess
.
check_output
(
cmd
,
shell
=
True
)
end
=
time
.
time
()
return
end
-
start
def
tcp
(
deno_exe
,
megs
):
size
=
megs
*
MB
# Run deno echo server in the background.
echo_server
=
subprocess
.
Popen
(
[
deno_exe
,
"--allow-net"
,
"tests/echo_server.ts"
,
ADDR
])
time
.
sleep
(
1
)
# wait for deno to wake up. TODO racy.
try
:
start
=
time
.
time
()
cmd
=
(
"head -c %s /dev/zero "
%
size
)
+
"| nc "
+
ADDR
.
replace
(
":"
,
" "
)
print
cmd
subprocess
.
check_output
(
cmd
,
shell
=
True
)
end
=
time
.
time
()
return
end
-
start
finally
:
echo_server
.
kill
()
if
__name__
==
'__main__'
:
deno_exe
=
sys
.
argv
[
1
]
megs
=
int
(
sys
.
argv
[
2
])
if
not
deno_exe
or
not
megs
:
print
"Usage ./tools/throughput_benchmark.py out/debug/deno 100"
sys
.
exit
(
1
)
secs
=
tcp_throughput_benchmark
(
sys
.
argv
[
1
],
megs
)
print
secs
,
"seconds"
website/app.js
浏览文件 @
c814d5a9
...
...
@@ -16,18 +16,41 @@ export function getTravisData() {
.
then
(
data
=>
data
.
builds
.
reverse
());
}
export
function
createExecTimeColumns
(
data
)
{
const
benchmarkNames
=
Object
.
keys
(
data
[
data
.
length
-
1
].
benchmark
);
return
benchmarkNames
.
map
(
name
=>
[
name
,
function
getBenchmarkVarieties
(
data
,
benchmarkName
)
{
// Look at last sha hash.
const
last
=
data
[
data
.
length
-
1
];
return
Object
.
keys
(
last
[
benchmarkName
]);
}
export
function
createColumns
(
data
,
benchmarkName
)
{
const
varieties
=
getBenchmarkVarieties
(
data
,
benchmarkName
);
return
varieties
.
map
(
variety
=>
[
variety
,
...
data
.
map
(
d
=>
{
const
benchmark
=
d
.
benchmark
[
name
];
const
meanValue
=
benchmark
?
benchmark
.
mean
:
0
;
return
meanValue
||
null
;
if
(
d
[
benchmarkName
]
!=
null
)
{
if
(
d
[
benchmarkName
][
variety
]
!=
null
)
{
const
v
=
d
[
benchmarkName
][
variety
];
if
(
benchmarkName
==
"
benchmark
"
)
{
const
meanValue
=
v
?
v
.
mean
:
0
;
return
meanValue
||
null
;
}
else
{
return
v
;
}
}
}
return
null
;
})
]);
}
export
function
createExecTimeColumns
(
data
)
{
return
createColumns
(
data
,
"
benchmark
"
);
}
export
function
createThroughputColumns
(
data
)
{
return
createColumns
(
data
,
"
throughput
"
);
}
export
function
createBinarySizeColumns
(
data
)
{
const
propName
=
"
binary_size
"
;
const
binarySizeNames
=
Object
.
keys
(
data
[
data
.
length
-
1
][
propName
]);
...
...
@@ -108,6 +131,7 @@ export async function main() {
const
travisData
=
(
await
getTravisData
()).
filter
(
d
=>
d
.
duration
>
0
);
const
execTimeColumns
=
createExecTimeColumns
(
data
);
const
throughputColumns
=
createThroughputColumns
(
data
);
const
binarySizeColumns
=
createBinarySizeColumns
(
data
);
const
threadCountColumns
=
createThreadCountColumns
(
data
);
const
syscallCountColumns
=
createSyscallCountColumns
(
data
);
...
...
@@ -146,6 +170,24 @@ export async function main() {
}
});
c3
.
generate
({
bindto
:
"
#throughput-chart
"
,
data
:
{
columns
:
throughputColumns
,
onclick
:
viewCommitOnClick
(
sha1List
)
},
axis
:
{
x
:
{
type
:
"
category
"
,
show
:
false
,
categories
:
sha1ShortList
},
y
:
{
label
:
"
seconds
"
}
}
});
c3
.
generate
({
bindto
:
"
#binary-size-chart
"
,
data
:
{
...
...
website/app_test.js
浏览文件 @
c814d5a9
...
...
@@ -22,6 +22,12 @@ const regularData = [
"
main.js.map
"
:
80000000
,
"
snapshot_deno.bin
"
:
70000000
},
throughput
:
{
"
100M_tcp
"
:
3.6
,
"
100M_cat
"
:
3.0
,
"
10M_tcp
"
:
1.6
,
"
10M_cat
"
:
1.0
},
benchmark
:
{
hello
:
{
mean
:
0.05
...
...
@@ -54,6 +60,12 @@ const regularData = [
"
main.js.map
"
:
80000001
,
"
snapshot_deno.bin
"
:
70000001
},
throughput
:
{
"
100M_tcp
"
:
3.6
,
"
100M_cat
"
:
3.0
,
"
10M_tcp
"
:
1.6
,
"
10M_cat
"
:
1.0
},
benchmark
:
{
hello
:
{
mean
:
0.055
...
...
@@ -84,6 +96,7 @@ const irregularData = [
created_at
:
"
2018-01-01T01:00:00Z
"
,
sha1
:
"
123
"
,
benchmark
:
{},
throughput
:
{},
binary_size
:
{},
thread_count
:
{},
syscall_count
:
{}
...
...
@@ -97,6 +110,9 @@ const irregularData = [
cold_hello
:
{},
cold_relative_import
:
{}
},
throughput
:
{
"
100M_tcp
"
:
3.0
},
binary_size
:
{
deno
:
1
},
...
...
website/index.html
浏览文件 @
c814d5a9
...
...
@@ -26,6 +26,9 @@
A cold startup is when deno must compile from scratch.
<div
id=
"exec-time-chart"
></div>
<h2>
Throughput
</h2>
<div
id=
"throughput-chart"
></div>
<h2>
Executable size
</h2>
deno ships only a single binary. We track its size here.
<div
id=
"binary-size-chart"
></div>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录