INNER CODE UNIT · JavaScript
makeParallelRequests
nodejs/undici · benchmarks/_util/index.js:5
function makeParallelRequests (cb) {
const promises = new Array(parallelRequests)
for (let i = 0; i < parallelRequests; ++i) {
promises[i] = new Promise(cb)
}
return Promise.all(promises)
}
function printResults (results) {
// Sort results by least performant first, then compare relative performances and also printing padding
let last
const rows = Object.entries(results)
// If any failed, put on the top of the list, otherwise order by mean, ascending
.sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean))
.map(([name, result]) => {
if (!result.success) {
return {