diff options
| author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2018-09-24 18:12:52 -0400 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-09-24 18:12:52 -0400 |
| commit | 1729bdb0d7f504436cacc07bedba642591fdb0cb (patch) | |
| tree | 8d9fb23ef2b942e8df6fea7b6637185fa1a0d709 /website | |
| parent | d6a97ae4f02a7150165877e304778c96b90ddd5a (diff) | |
Add thread count benchmark (#811)
Diffstat (limited to 'website')
| -rw-r--r-- | website/app.js | 26 | ||||
| -rw-r--r-- | website/app_test.js | 22 | ||||
| -rw-r--r-- | website/index.html | 2 |
3 files changed, 48 insertions, 2 deletions
diff --git a/website/app.js b/website/app.js index 612cc7af0..27baa1958 100644 --- a/website/app.js +++ b/website/app.js @@ -20,6 +20,20 @@ export function createBinarySizeColumns(data) { return [["binary_size", ...data.map(d => d.binary_size || 0)]]; } +const threadCountNames = ["set_timeout"]; +export function createThreadCountColumns(data) { + return threadCountNames.map(name => [ + name, + ...data.map(d => { + const threadCountData = d["thread_count"]; + if (!threadCountData) { + return 0; + } + return threadCountData[name] || 0; + }) + ]); +} + export function createSha1List(data) { return data.map(d => d.sha1); } @@ -40,6 +54,7 @@ export async function main() { const execTimeColumns = createExecTimeColumns(data); const binarySizeColumns = createBinarySizeColumns(data); + const threadCountColumns = createThreadCountColumns(data); const sha1List = createSha1List(data); c3.generate({ @@ -68,4 +83,15 @@ export async function main() { } } }); + + c3.generate({ + bindto: "#thread-count-chart", + data: { columns: threadCountColumns }, + axis: { + x: { + type: "category", + categories: sha1List + } + } + }); } diff --git a/website/app_test.js b/website/app_test.js index 74ccb406d..5fca1e44c 100644 --- a/website/app_test.js +++ b/website/app_test.js @@ -1,9 +1,10 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. -import { test, testPerm, assertEqual } from "../js/test_util.ts"; +import { test, assertEqual } from "../js/test_util.ts"; import { createBinarySizeColumns, createExecTimeColumns, + createThreadCountColumns, createSha1List, formatBytes } from "./app.js"; @@ -20,6 +21,9 @@ const regularData = [ relative_import: { mean: 0.06 } + }, + thread_count: { + set_timeout: 4 } }, { @@ -33,6 +37,9 @@ const regularData = [ relative_import: { mean: 0.065 } + }, + thread_count: { + set_timeout: 5 } } ]; @@ -44,7 +51,8 @@ const irregularData = [ benchmark: { hello: {}, relative_import: {} - } + }, + thread_count: {} }, { created_at: "2018-02-01T01:00:00Z", @@ -76,6 +84,16 @@ test(function createBinarySizeColumnsIrregularData() { assertEqual(columns, [["binary_size", 0, 0]]); }); +test(function createThreadCountColumnsRegularData() { + const columns = createThreadCountColumns(regularData); + assertEqual(columns, [["set_timeout", 4, 5]]); +}); + +test(function createThreadCountColumnsIrregularData() { + const columns = createThreadCountColumns(irregularData); + assertEqual(columns, [["set_timeout", 0, 0]]); +}); + test(function createSha1ListRegularData() { const sha1List = createSha1List(regularData); assertEqual(sha1List, ["abcdef", "012345"]); diff --git a/website/index.html b/website/index.html index 6ee68af2f..96d1afd7f 100644 --- a/website/index.html +++ b/website/index.html @@ -9,6 +9,8 @@ <div id="exec-time-chart"></div> <h2>Binary size chart</h2> <div id="binary-size-chart"></div> + <h2>Thread count chart</h2> + <div id="thread-count-chart"></div> <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> <script type="module"> |
