mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
Rename HTTP benchmarks (#2350)
This commit is contained in:
parent
5e56e26c8b
commit
160a815767
3 changed files with 44 additions and 26 deletions
|
@ -6,17 +6,23 @@ import util
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
# Some of the benchmarks in this file have been renamed. In case the history
|
||||||
|
# somehow gets messed up:
|
||||||
|
# "node_http" was once called "node"
|
||||||
|
# "deno_tcp" was once called "deno"
|
||||||
|
# "deno_http" was once called "deno_net_http"
|
||||||
|
|
||||||
ADDR = "127.0.0.1:4544"
|
ADDR = "127.0.0.1:4544"
|
||||||
DURATION = "10s"
|
DURATION = "10s"
|
||||||
|
|
||||||
|
|
||||||
def deno_http_benchmark(deno_exe):
|
def deno_tcp(deno_exe):
|
||||||
deno_cmd = [deno_exe, "run", "--allow-net", "tests/http_bench.ts", ADDR]
|
deno_cmd = [deno_exe, "run", "--allow-net", "tools/deno_tcp.ts", ADDR]
|
||||||
print "http_benchmark testing DENO."
|
print "http_benchmark testing DENO."
|
||||||
return run(deno_cmd)
|
return run(deno_cmd)
|
||||||
|
|
||||||
|
|
||||||
def deno_net_http_benchmark(deno_exe):
|
def deno_http(deno_exe):
|
||||||
deno_cmd = [
|
deno_cmd = [
|
||||||
deno_exe, "run", "--allow-net",
|
deno_exe, "run", "--allow-net",
|
||||||
"js/deps/https/deno.land/std/http/http_bench.ts", ADDR
|
"js/deps/https/deno.land/std/http/http_bench.ts", ADDR
|
||||||
|
@ -40,19 +46,19 @@ def deno_core_multi(exe):
|
||||||
return run([exe, "--multi-thread"])
|
return run([exe, "--multi-thread"])
|
||||||
|
|
||||||
|
|
||||||
def node_http_benchmark():
|
def node_http():
|
||||||
node_cmd = ["node", "tools/node_http.js", ADDR.split(":")[1]]
|
node_cmd = ["node", "tools/node_http.js", ADDR.split(":")[1]]
|
||||||
print "http_benchmark testing NODE."
|
print "http_benchmark testing NODE."
|
||||||
return run(node_cmd)
|
return run(node_cmd)
|
||||||
|
|
||||||
|
|
||||||
def node_tcp_benchmark():
|
def node_tcp():
|
||||||
node_cmd = ["node", "tools/node_tcp.js", ADDR.split(":")[1]]
|
node_cmd = ["node", "tools/node_tcp.js", ADDR.split(":")[1]]
|
||||||
print "http_benchmark testing node_tcp.js"
|
print "http_benchmark testing node_tcp.js"
|
||||||
return run(node_cmd)
|
return run(node_cmd)
|
||||||
|
|
||||||
|
|
||||||
def hyper_http_benchmark(hyper_hello_exe):
|
def hyper_http(hyper_hello_exe):
|
||||||
hyper_cmd = [hyper_hello_exe, ADDR.split(":")[1]]
|
hyper_cmd = [hyper_hello_exe, ADDR.split(":")[1]]
|
||||||
print "http_benchmark testing RUST hyper."
|
print "http_benchmark testing RUST hyper."
|
||||||
return run(hyper_cmd)
|
return run(hyper_cmd)
|
||||||
|
@ -63,13 +69,16 @@ def http_benchmark(build_dir):
|
||||||
core_http_bench_exe = os.path.join(build_dir, "deno_core_http_bench")
|
core_http_bench_exe = os.path.join(build_dir, "deno_core_http_bench")
|
||||||
deno_exe = os.path.join(build_dir, "deno")
|
deno_exe = os.path.join(build_dir, "deno")
|
||||||
return {
|
return {
|
||||||
"deno": deno_http_benchmark(deno_exe),
|
# "deno_tcp" was once called "deno"
|
||||||
"deno_net_http": deno_net_http_benchmark(deno_exe),
|
"deno_tcp": deno_tcp(deno_exe),
|
||||||
|
# "deno_http" was once called "deno_net_http"
|
||||||
|
"deno_http": deno_http(deno_exe),
|
||||||
"deno_core_single": deno_core_single(core_http_bench_exe),
|
"deno_core_single": deno_core_single(core_http_bench_exe),
|
||||||
"deno_core_multi": deno_core_multi(core_http_bench_exe),
|
"deno_core_multi": deno_core_multi(core_http_bench_exe),
|
||||||
"node": node_http_benchmark(),
|
# "node_http" was once called "node"
|
||||||
"node_tcp": node_tcp_benchmark(),
|
"node_http": node_http(),
|
||||||
"hyper": hyper_http_benchmark(hyper_hello_exe)
|
"node_tcp": node_tcp(),
|
||||||
|
"hyper": hyper_http(hyper_hello_exe)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,4 +115,4 @@ if __name__ == '__main__':
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "Usage ./tools/http_benchmark.py target/debug/deno"
|
print "Usage ./tools/http_benchmark.py target/debug/deno"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
deno_net_http_benchmark(sys.argv[1])
|
deno_http(sys.argv[1])
|
||||||
|
|
|
@ -34,37 +34,46 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<!-- TODO rename "deno" to "deno_tcp". -->
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/denoland/deno/blob/master/tests/http_bench.ts"
|
href="https://github.com/denoland/deno/blob/master/tools/deno_tcp.ts"
|
||||||
>
|
>deno_tcp</a>
|
||||||
deno
|
|
||||||
</a>
|
|
||||||
is a fake http server that doesn't parse HTTP. It is comparable to
|
is a fake http server that doesn't parse HTTP. It is comparable to
|
||||||
<a
|
<a
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_tcp.js"
|
href="https://github.com/denoland/deno/blob/master/tools/node_tcp.js"
|
||||||
>
|
>node_tcp</a>
|
||||||
node_tcp
|
|
||||||
</a>
|
|
||||||
.
|
.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/denoland/deno_std/blob/master/http/http_bench.ts"
|
href="https://github.com/denoland/deno_std/blob/master/http/http_bench.ts"
|
||||||
>
|
>deno_http</a>
|
||||||
deno_net_http
|
|
||||||
</a>
|
|
||||||
is a web server written in TypeScript. It is comparable to
|
is a web server written in TypeScript. It is comparable to
|
||||||
<a
|
<a
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/node_http.js"
|
href="https://github.com/denoland/deno/blob/master/tools/node_http.js"
|
||||||
>
|
>node_http</a>
|
||||||
node_http
|
|
||||||
</a>
|
|
||||||
.
|
.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>deno_core_single and deno_core_multi are two versions of
|
||||||
|
a minimal fake HTTP server. It blindly reads and writes fixed HTTP
|
||||||
|
packets. It is comparable to deno_tcp and node_tcp.
|
||||||
|
This is a standalone executable that uses <a
|
||||||
|
href="https://crates.io/crates/deno">the deno rust crate</a>. The
|
||||||
|
code is in
|
||||||
|
<a
|
||||||
|
href="https://github.com/denoland/deno/blob/master/core/examples/http_bench.rs"
|
||||||
|
>http_bench.rs</a>
|
||||||
|
and
|
||||||
|
<a
|
||||||
|
href="https://github.com/denoland/deno/blob/master/core/examples/http_bench.js"
|
||||||
|
>http_bench.js</a>. single uses <a
|
||||||
|
href="https://docs.rs/tokio/0.1.19/tokio/runtime/current_thread/index.html">tokio::runtime::current_thread</a>
|
||||||
|
and multi uses <a
|
||||||
|
href="https://docs.rs/tokio/0.1.19/tokio/runtime/">tokio::runtime::threadpool</a>.
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/denoland/deno/blob/master/tools/hyper_hello.rs"
|
href="https://github.com/denoland/deno/blob/master/tools/hyper_hello.rs"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue