diff --git a/.gitignore b/.gitignore index 284a7b1ee4..ebe4f34908 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ node_modules # temp benchmark data /website/data.json /website/recent.json +/js/gen diff --git a/.gitmodules b/.gitmodules index d9240f27e3..238cee5262 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,6 @@ path = build url = https://github.com/denoland/chromium_build.git branch = deno +[submodule "js/deps/https/deno.land/x/net"] + path = js/deps/https/deno.land/x/net + url = https://github.com/denoland/deno_net.git diff --git a/js/deps/https/deno.land/x/net b/js/deps/https/deno.land/x/net new file mode 160000 index 0000000000..958dadc875 --- /dev/null +++ b/js/deps/https/deno.land/x/net @@ -0,0 +1 @@ +Subproject commit 958dadc8752f1aface8cff39c56011b016fb1460 diff --git a/tools/http_benchmark.py b/tools/http_benchmark.py index f94144eac7..2ff34b831b 100755 --- a/tools/http_benchmark.py +++ b/tools/http_benchmark.py @@ -16,6 +16,20 @@ def deno_http_benchmark(deno_exe): return run(deno_cmd) +def deno_net_http_benchmark(deno_exe): + deno_cmd = [ + deno_exe, "--allow-net", "js/deps/https/deno.land/x/net/http_bench.ts", + ADDR + ] + print "http_benchmark testing DENO using net/http." + return run( + deno_cmd, + merge_env={ + # Load from //js/deps/https/deno.land/net/ submodule. + "DENO_DIR": os.path.join(util.root_path, "js") + }) + + def node_http_benchmark(): node_cmd = ["node", "tools/node_http.js", ADDR.split(":")[1]] print "http_benchmark testing NODE." @@ -38,15 +52,23 @@ def http_benchmark(deno_exe, hyper_hello_exe): r = {} # TODO Rename to "deno_tcp" r["deno"] = deno_http_benchmark(deno_exe) + r["deno_net_http"] = deno_net_http_benchmark(deno_exe) r["node"] = node_http_benchmark() r["node_tcp"] = node_tcp_benchmark() r["hyper"] = hyper_http_benchmark(hyper_hello_exe) return r -def run(server_cmd): +def run(server_cmd, merge_env=None): # Run deno echo server in the background. - server = subprocess.Popen(server_cmd) + if merge_env is None: + env = None + else: + env = os.environ.copy() + for key, value in merge_env.iteritems(): + env[key] = value + + server = subprocess.Popen(server_cmd, env=env) time.sleep(5) # wait for server to wake up. TODO racy. try: cmd = "third_party/wrk/%s/wrk -d %s http://%s/" % (util.platform(), @@ -64,4 +86,4 @@ if __name__ == '__main__': if len(sys.argv) < 2: print "Usage ./tools/http_benchmark.py target/debug/deno" sys.exit(1) - deno_http_benchmark(sys.argv[1]) + deno_net_http_benchmark(sys.argv[1])