From 03525e1a2714de6cf59d82c3d77b196b63863396 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Sat, 27 Jan 2024 03:02:48 +0100 Subject: [PATCH] chore: remove table as dev dependency --- benchmarks/benchmark-http2.js | 59 ++++++++++------------------------- benchmarks/benchmark-https.js | 59 ++++++++++------------------------- benchmarks/benchmark.js | 59 ++++++++++------------------------- package.json | 1 - 4 files changed, 48 insertions(+), 130 deletions(-) diff --git a/benchmarks/benchmark-http2.js b/benchmarks/benchmark-http2.js index af7b3cdbd86..8d9716d4b59 100644 --- a/benchmarks/benchmark-http2.js +++ b/benchmarks/benchmark-http2.js @@ -5,7 +5,6 @@ const { createSecureContext } = require('tls') const os = require('os') const path = require('path') const { readFileSync } = require('fs') -const { table } = require('table') const { Writable } = require('stream') const { isMainThread } = require('worker_threads') @@ -126,7 +125,13 @@ function printResults (results) { .sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean)) .map(([name, result]) => { if (!result.success) { - return [name, result.size, 'Errored', 'N/A', 'N/A'] + return { + Tests: name, + Samples: result.size, + Result: 'Errored', + Tolerance: 'N/A', + 'Difference with Slowest': 'N/A' + } } // Calculate throughput and relative performance @@ -138,48 +143,16 @@ function printResults (results) { last = mean } - return [ - name, - size, - `${((connections * 1e9) / mean).toFixed(2)} req/sec`, - `± ${((standardError / mean) * 100).toFixed(2)} %`, - relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' - ] + return { + Tests: name, + Samples: size, + Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`, + Tolerance: `± ${((standardError / mean) * 100).toFixed(2)} %`, + 'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' + } }) - console.log(results) - - // Add the header row - rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest']) - - return table(rows, { - columns: { - 0: { - alignment: 'left' - }, - 1: { - alignment: 'right' - }, - 2: { - alignment: 'right' - }, - 3: { - alignment: 'right' - }, - 4: { - alignment: 'right' - } - }, - drawHorizontalLine: (index, size) => index > 0 && index < size, - border: { - bodyLeft: '│', - bodyRight: '│', - bodyJoin: '│', - joinLeft: '|', - joinRight: '|', - joinJoin: '|' - } - }) + return console.table(rows) } const experiments = { @@ -292,7 +265,7 @@ async function main () { throw err } - console.log(printResults(results)) + printResults(results) dispatcher.destroy() } ) diff --git a/benchmarks/benchmark-https.js b/benchmarks/benchmark-https.js index b2ec951ddbc..644f019c37d 100644 --- a/benchmarks/benchmark-https.js +++ b/benchmarks/benchmark-https.js @@ -4,7 +4,6 @@ const https = require('https') const os = require('os') const path = require('path') const { readFileSync } = require('fs') -const { table } = require('table') const { Writable } = require('stream') const { isMainThread } = require('worker_threads') @@ -140,7 +139,13 @@ function printResults (results) { .sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean)) .map(([name, result]) => { if (!result.success) { - return [name, result.size, 'Errored', 'N/A', 'N/A'] + return { + Tests: name, + Samples: result.size, + Result: 'Errored', + Tolerance: 'N/A', + 'Difference with Slowest': 'N/A' + } } // Calculate throughput and relative performance @@ -152,48 +157,16 @@ function printResults (results) { last = mean } - return [ - name, - size, - `${((connections * 1e9) / mean).toFixed(2)} req/sec`, - `± ${((standardError / mean) * 100).toFixed(2)} %`, - relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' - ] + return { + Tests: name, + Samples: size, + Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`, + Tolerance: `± ${((standardError / mean) * 100).toFixed(2)} %`, + 'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' + } }) - console.log(results) - - // Add the header row - rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest']) - - return table(rows, { - columns: { - 0: { - alignment: 'left' - }, - 1: { - alignment: 'right' - }, - 2: { - alignment: 'right' - }, - 3: { - alignment: 'right' - }, - 4: { - alignment: 'right' - } - }, - drawHorizontalLine: (index, size) => index > 0 && index < size, - border: { - bodyLeft: '│', - bodyRight: '│', - bodyJoin: '│', - joinLeft: '|', - joinRight: '|', - joinJoin: '|' - } - }) + return console.table(rows) } const experiments = { @@ -305,7 +278,7 @@ async function main () { throw err } - console.log(printResults(results)) + printResults(results) dispatcher.destroy() } ) diff --git a/benchmarks/benchmark.js b/benchmarks/benchmark.js index b54b2776af5..77b814c98e3 100644 --- a/benchmarks/benchmark.js +++ b/benchmarks/benchmark.js @@ -3,7 +3,6 @@ const http = require('http') const os = require('os') const path = require('path') -const { table } = require('table') const { Writable } = require('stream') const { isMainThread } = require('worker_threads') @@ -149,7 +148,13 @@ function printResults (results) { .sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean)) .map(([name, result]) => { if (!result.success) { - return [name, result.size, 'Errored', 'N/A', 'N/A'] + return { + Tests: name, + Samples: result.size, + Result: 'Errored', + Tolerance: 'N/A', + 'Difference with Slowest': 'N/A' + } } // Calculate throughput and relative performance @@ -161,48 +166,16 @@ function printResults (results) { last = mean } - return [ - name, - size, - `${((connections * 1e9) / mean).toFixed(2)} req/sec`, - `± ${((standardError / mean) * 100).toFixed(2)} %`, - relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' - ] + return { + Tests: name, + Samples: size, + Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`, + Tolerance: `± ${((standardError / mean) * 100).toFixed(2)} %`, + 'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-' + } }) - console.log(results) - - // Add the header row - rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest']) - - return table(rows, { - columns: { - 0: { - alignment: 'left' - }, - 1: { - alignment: 'right' - }, - 2: { - alignment: 'right' - }, - 3: { - alignment: 'right' - }, - 4: { - alignment: 'right' - } - }, - drawHorizontalLine: (index, size) => index > 0 && index < size, - border: { - bodyLeft: '│', - bodyRight: '│', - bodyJoin: '│', - joinLeft: '|', - joinRight: '|', - joinJoin: '|' - } - }) + return console.table(rows) } const experiments = { @@ -366,7 +339,7 @@ async function main () { throw err } - console.log(printResults(results)) + printResults(results) dispatcher.destroy() } ) diff --git a/package.json b/package.json index 3032b5608af..c4f2503b202 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,6 @@ "sinon": "^17.0.1", "snazzy": "^9.0.0", "standard": "^17.0.0", - "table": "^6.8.0", "tap": "^16.1.0", "tsd": "^0.30.1", "typescript": "^5.0.2",