summaryrefslogtreecommitdiff
path: root/tools/throughput_benchmark.py
diff options
context:
space:
mode:
authorValentin Anger <syrupthinker@gryphno.de>2020-08-28 15:03:50 +0200
committerGitHub <noreply@github.com>2020-08-28 09:03:50 -0400
commit31f32ed8c4082d36ad2a4ea460366c0d57a5ddbc (patch)
tree2b60111cd53dd4034d1a92ee8caff89d164b7d2d /tools/throughput_benchmark.py
parent3d23208019a2c9faaf265ff13ad59f2d04f10079 (diff)
Move benchmarks to Rust (#7134)
All benchmarks are done in Rust and can be invoked with `cargo bench`. Currently this has it's own "harness" that behaves like `./tools/benchmark.py` did. Because of this tests inside `cli/bench` are currently not run. This should be switched to the language provided harness once the `#[bench]` attribute has been stabilized.
Diffstat (limited to 'tools/throughput_benchmark.py')
-rwxr-xr-xtools/throughput_benchmark.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/tools/throughput_benchmark.py b/tools/throughput_benchmark.py
deleted file mode 100755
index f5b9f2db2..000000000
--- a/tools/throughput_benchmark.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2018-2020 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 target/debug/test_server and visit
-# http://localhost:4545/website
-
-import os
-import sys
-import time
-import subprocess
-import util
-
-MB = 1024 * 1024
-SERVER_ADDR = "0.0.0.0:4544"
-CLIENT_ADDR = "127.0.0.1 4544"
-
-
-def cat(deno_exe, megs):
- size = megs * MB
- start = time.time()
- cmd = deno_exe + " run --allow-read "
- cmd += "cli/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.
- args = [
- deno_exe, "run", "--allow-net", "cli/tests/echo_server.ts", SERVER_ADDR
- ]
- print args
- echo_server = subprocess.Popen(args)
-
- time.sleep(5) # wait for deno to wake up. TODO racy.
- try:
- start = time.time()
- nc_cmd = "nc " + CLIENT_ADDR
- cmd = ("head -c %s /dev/zero " % size) + " | " + nc_cmd
- print cmd
- subprocess.check_output(cmd, shell=True)
- end = time.time()
- return end - start
- finally:
- echo_server.kill()
-
-
-def main():
- deno_exe = sys.argv[1]
- megs = int(sys.argv[2])
- if not deno_exe or not megs:
- print "Usage ./tools/throughput_benchmark.py target/debug/deno 100"
- sys.exit(1)
- secs = tcp(sys.argv[1], megs)
- print secs, "seconds"
-
-
-if __name__ == '__main__':
- main()