From d43b43ca781b025b9a6a54827ea3ef193972ef24 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 2 Sep 2019 17:07:11 -0400 Subject: Refactor snapshot build (#2825) Instead of using core/snapshot_creator.rs, instead two crates are introduced which allow building the snapshot during build.rs. Rollup is removed and replaced with our own bundler. This removes the Node build dependency. Modules in //js now use Deno-style imports with file extensions, rather than Node style extensionless imports. This improves incremental build time when changes are made to //js files by about 40 seconds. --- tools/benchmark.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'tools/benchmark.py') diff --git a/tools/benchmark.py b/tools/benchmark.py index 8615a17d9..d6c45259d 100755 --- a/tools/benchmark.py +++ b/tools/benchmark.py @@ -11,7 +11,8 @@ import sys import json import time import shutil -from util import root_path, run, run_output, build_path, executable_suffix +from util import find_exts, root_path, run, run_output +from util import build_path, executable_suffix import tempfile import http_server import throughput_benchmark @@ -59,22 +60,26 @@ def import_data_from_gh_pages(): def get_binary_sizes(build_dir): + # Because cargo's OUT_DIR is not predictable, we have to search the build + # tree for these files... + files = find_exts([build_dir], ["js", "map", "bin"]) path_dict = { - "deno": - os.path.join(build_dir, "deno" + executable_suffix), - "main.js": - os.path.join(build_dir, "gen/cli/bundle/main.js"), - "main.js.map": - os.path.join(build_dir, "gen/cli/bundle/main.js.map"), - "compiler.js": - os.path.join(build_dir, "gen/cli/bundle/compiler.js"), - "compiler.js.map": - os.path.join(build_dir, "gen/cli/bundle/compiler.js.map"), - "snapshot_deno.bin": - os.path.join(build_dir, "gen/cli/snapshot_deno.bin"), - "snapshot_compiler.bin": - os.path.join(build_dir, "gen/cli/snapshot_compiler.bin") + "deno": os.path.join(build_dir, "deno" + executable_suffix), } + for f in files: + if f.endswith("CLI_SNAPSHOT.js"): + path_dict["CLI_SNAPSHOT.js"] = f + elif f.endswith("CLI_SNAPSHOT.js.map"): + path_dict["CLI_SNAPSHOT.js.map"] = f + elif f.endswith("CLI_SNAPSHOT.bin"): + path_dict["CLI_SNAPSHOT.bin"] = f + elif f.endswith("COMPILER_SNAPSHOT.js"): + path_dict["COMPILER_SNAPSHOT.js"] = f + elif f.endswith("COMPILER_SNAPSHOT.js.map"): + path_dict["COMPILER_SNAPSHOT.js.map"] = f + elif f.endswith("COMPILER_SNAPSHOT.bin"): + path_dict["COMPILER_SNAPSHOT.bin"] = f + sizes = {} for name, path in path_dict.items(): assert os.path.exists(path) -- cgit v1.2.3