Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove table as dev dependency #2649

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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",
Expand Down
Loading