diff options
-rwxr-xr-x | tools/benchmark.py | 22 | ||||
-rw-r--r-- | website/app.ts | 10 | ||||
-rw-r--r-- | website/benchmarks.html | 25 |
3 files changed, 56 insertions, 1 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. diff --git a/website/app.ts b/website/app.ts index c93ed0986..326e02f63 100644 --- a/website/app.ts +++ b/website/app.ts @@ -108,10 +108,18 @@ export function createSyscallCountColumns(data) { ]); } +export function createBundleSizeColumns(data) { + return createColumns(data, "bundle_size"); +} + export function createSha1List(data) { return data.map(d => d.sha1); } +export function formatKB(bytes) { + return (bytes / 1024).toFixed(2); +} + export function formatMB(bytes) { return (bytes / (1024 * 1024)).toFixed(2); } @@ -247,6 +255,7 @@ export async function drawChartsFromBenchmarkData(dataUrl) { const binarySizeColumns = createBinarySizeColumns(data); const threadCountColumns = createThreadCountColumns(data); const syscallCountColumns = createSyscallCountColumns(data); + const bundleSizeColumns = createBundleSizeColumns(data); const sha1List = createSha1List(data); const sha1ShortList = sha1List.map(sha1 => sha1.substring(0, 6)); @@ -277,6 +286,7 @@ export async function drawChartsFromBenchmarkData(dataUrl) { gen("#binary-size-chart", binarySizeColumns, "megabytes", formatMB); gen("#thread-count-chart", threadCountColumns, "threads"); gen("#syscall-count-chart", syscallCountColumns, "syscalls"); + gen("#bundle-size-chart", bundleSizeColumns, "kilobytes", formatKB); } export function main(): void { diff --git a/website/benchmarks.html b/website/benchmarks.html index 8b2b44d72..68e1fa57d 100644 --- a/website/benchmarks.html +++ b/website/benchmarks.html @@ -221,11 +221,34 @@ <p>How many threads various programs use.</p> <div id="thread-count-chart"></div> - <h3 id="syscalls">Syscall count <a href="#syscalls">#</a></h3> + <h3 id="bundles">Syscall count <a href="#bundles">#</a></h3> <p> How many total syscalls are performed when executing a given script. </p> <div id="syscall-count-chart"></div> + + <h3 id="bundles">Bundle size <a href="#syscalls">#</a></h3> + <p> + Size of different bundled scripts. + </p> + + <ul> + <li> + <a + href="https://deno.land/std/http/file_server.ts" + >file_server</a + > + </li> + + <li> + <a + href="https://deno.land/std/examples/gist.ts" + >gist</a + > + </li> + </ul> + + <div id="bundle-size-chart"></div> </main> <script src="https://unpkg.com/d3@5.7.0/dist/d3.min.js"></script> <script src="https://unpkg.com/c3@0.6.7/c3.min.js"></script> |