From 5508bfba9d053206578ac2390206af5aadccb168 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Thu, 23 Aug 2018 22:31:52 -0400 Subject: [PATCH] Print perf results as a formatted table --- perfBenchmark.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/perfBenchmark.js b/perfBenchmark.js index 994eb68..c4f14ca 100644 --- a/perfBenchmark.js +++ b/perfBenchmark.js @@ -2,6 +2,7 @@ const express = require("express"); const puppeteer = require("puppeteer"); const tracealyzer = require('tracealyzer'); const spawn = require("cross-spawn"); +const Table = require("cli-table2"); const fs = require("fs"); @@ -199,15 +200,30 @@ app.listen(9999, async () => { await browser.close(); - Object.keys(versionPerfEntries).sort().forEach(version => { - const versionResults = versionPerfEntries[version]; + const table = new Table({ + head: ['Build', 'Avg FPS', 'Scripting', 'Rendering', 'Painting', 'FPS Values'] + }); + + const rows = VERSIONS.map(version => { + const versionResults = versionPerfEntries[version]; const {fps, profile} = versionResults; - console.log(version); - console.log(" FPS (average, values): ", fps.average, "; ", fps.values); - console.log(" Profile: ", profile) - }) + const rowContents = [ + version, + fps.average.toFixed(2), + profile.scripting.toFixed(2), + profile.rendering.toFixed(2), + profile.painting.toFixed(2), + fps.values.toString() + ] + + return rowContents; + }); + + table.push(...rows); + + console.log(table.toString()); process.exit(0);