Skip to content

Commit

Permalink
chore: remove table as dev dependency (#2649)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Jan 27, 2024
1 parent 8b9726e commit 12e067e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 130 deletions.
59 changes: 16 additions & 43 deletions benchmarks/benchmark-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -292,7 +265,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
59 changes: 16 additions & 43 deletions benchmarks/benchmark-https.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -305,7 +278,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
59 changes: 16 additions & 43 deletions benchmarks/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -366,7 +339,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,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",
Expand Down

0 comments on commit 12e067e

Please sign in to comment.