summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-05-14 15:22:50 -0400
committerGitHub <noreply@github.com>2019-05-14 15:22:50 -0400
commit160a815767fc25b0439e57ef13a1082dfb05dc99 (patch)
treefb11f9728444ff9522f08c1ba9a2838f3dde183a
parent5e56e26c8baad08954cdc3ecac34923dcdc39c12 (diff)
Rename HTTP benchmarks (#2350)
-rw-r--r--tools/deno_tcp.ts (renamed from tests/http_bench.ts)0
-rwxr-xr-xtools/http_benchmark.py33
-rw-r--r--website/benchmarks.html37
3 files changed, 44 insertions, 26 deletions
diff --git a/tests/http_bench.ts b/tools/deno_tcp.ts
index 5b61bd4cd..5b61bd4cd 100644
--- a/tests/http_bench.ts
+++ b/tools/deno_tcp.ts
diff --git a/tools/http_benchmark.py b/tools/http_benchmark.py
index 68d68e44a..c7c7a83b1 100755
--- a/tools/http_benchmark.py
+++ b/tools/http_benchmark.py
@@ -6,17 +6,23 @@ import util
import time
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"
DURATION = "10s"
-def deno_http_benchmark(deno_exe):
- deno_cmd = [deno_exe, "run", "--allow-net", "tests/http_bench.ts", ADDR]
+def deno_tcp(deno_exe):
+ deno_cmd = [deno_exe, "run", "--allow-net", "tools/deno_tcp.ts", ADDR]
print "http_benchmark testing DENO."
return run(deno_cmd)
-def deno_net_http_benchmark(deno_exe):
+def deno_http(deno_exe):
deno_cmd = [
deno_exe, "run", "--allow-net",
"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"])
-def node_http_benchmark():
+def node_http():
node_cmd = ["node", "tools/node_http.js", ADDR.split(":")[1]]
print "http_benchmark testing NODE."
return run(node_cmd)
-def node_tcp_benchmark():
+def node_tcp():
node_cmd = ["node", "tools/node_tcp.js", ADDR.split(":")[1]]
print "http_benchmark testing node_tcp.js"
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]]
print "http_benchmark testing RUST hyper."
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")
deno_exe = os.path.join(build_dir, "deno")
return {
- "deno": deno_http_benchmark(deno_exe),
- "deno_net_http": deno_net_http_benchmark(deno_exe),
+ # "deno_tcp" was once called "deno"
+ "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_multi": deno_core_multi(core_http_bench_exe),
- "node": node_http_benchmark(),
- "node_tcp": node_tcp_benchmark(),
- "hyper": hyper_http_benchmark(hyper_hello_exe)
+ # "node_http" was once called "node"
+ "node_http": node_http(),
+ "node_tcp": node_tcp(),
+ "hyper": hyper_http(hyper_hello_exe)
}
@@ -106,4 +115,4 @@ if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage ./tools/http_benchmark.py target/debug/deno"
sys.exit(1)
- deno_net_http_benchmark(sys.argv[1])
+ deno_http(sys.argv[1])
diff --git a/website/benchmarks.html b/website/benchmarks.html
index 4a7294af0..72c10f9b3 100644
--- a/website/benchmarks.html
+++ b/website/benchmarks.html
@@ -34,37 +34,46 @@
</p>
<ul>
- <!-- TODO rename "deno" to "deno_tcp". -->
<li>
<a
- href="https://github.com/denoland/deno/blob/master/tests/http_bench.ts"
- >
- deno
- </a>
+ href="https://github.com/denoland/deno/blob/master/tools/deno_tcp.ts"
+ >deno_tcp</a>
is a fake http server that doesn't parse HTTP. It is comparable to
<a
href="https://github.com/denoland/deno/blob/master/tools/node_tcp.js"
- >
- node_tcp
- </a>
+ >node_tcp</a>
.
</li>
<li>
<a
href="https://github.com/denoland/deno_std/blob/master/http/http_bench.ts"
- >
- deno_net_http
- </a>
+ >deno_http</a>
is a web server written in TypeScript. It is comparable to
<a
href="https://github.com/denoland/deno/blob/master/tools/node_http.js"
- >
- node_http
- </a>
+ >node_http</a>
.
</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>
<a
href="https://github.com/denoland/deno/blob/master/tools/hyper_hello.rs"