summaryrefslogtreecommitdiff
path: root/tools/benchmark.py
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-07-28 12:11:08 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-07-28 10:11:08 +0000
commit187310a3e151303504a1dc5830334ae7ac1fef57 (patch)
treecd0add94dc0c4fa8ce7cd2e60a26c537e11ed239 /tools/benchmark.py
parent877e5ed7844a1754080ddff9c095ed941072775f (diff)
benchmarks: add bundle size (#2690)
Diffstat (limited to 'tools/benchmark.py')
-rwxr-xr-xtools/benchmark.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py
index 41dbc5b96..8615a17d9 100755
--- a/tools/benchmark.py
+++ b/tools/benchmark.py
@@ -203,6 +203,27 @@ def run_http(build_dir, new_data):
new_data["max_latency"] = {k: v["max_latency"] for k, v in stats.items()}
+def bundle_benchmark(deno_exe):
+ bundles = {
+ "file_server": "https://deno.land/std/http/file_server.ts",
+ "gist": "https://deno.land/std/examples/gist.ts",
+ }
+
+ sizes = {}
+
+ for name, url in bundles.items():
+ # bundle
+ run([deno_exe, "bundle", url])
+ path = name + ".bundle.js"
+ # get size of bundle
+ assert os.path.exists(path)
+ sizes[name] = os.path.getsize(path)
+ # remove bundle
+ os.remove(path)
+
+ return sizes
+
+
def main(argv):
if len(argv) == 2:
build_dir = sys.argv[1]
@@ -232,6 +253,7 @@ def main(argv):
new_data["benchmark"] = run_exec_time(deno_exe, build_dir)
new_data["binary_size"] = get_binary_sizes(build_dir)
+ new_data["bundle_size"] = bundle_benchmark(deno_exe)
# Cannot run throughput benchmark on windows because they don't have nc or
# pipe.