mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
benchmark: add test
and all
options and improve errors"
This reverts commit 4671d551cf
and
contains a fix to the issue raised for the revert.
PR-URL: https://github.com/nodejs/node/pull/31755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
f64aafa2d5
commit
1760c23f75
38 changed files with 306 additions and 201 deletions
|
@ -13,14 +13,12 @@ const {
|
|||
} = require('async_hooks');
|
||||
const { createServer } = require('http');
|
||||
|
||||
// Configuration for the http server
|
||||
// there is no need for parameters in this test
|
||||
const connections = 500;
|
||||
const path = '/';
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: ['async-resource', 'destroy', 'async-local-storage'],
|
||||
asyncMethod: ['callbacks', 'async'],
|
||||
path: '/',
|
||||
connections: 500,
|
||||
duration: 5,
|
||||
n: [1e6]
|
||||
});
|
||||
|
||||
|
@ -165,7 +163,7 @@ const asyncMethods = {
|
|||
'async': getServeAwait
|
||||
};
|
||||
|
||||
function main({ type, asyncMethod }) {
|
||||
function main({ type, asyncMethod, connections, duration, path }) {
|
||||
const { server, close } = types[type](asyncMethods[asyncMethod]);
|
||||
|
||||
server
|
||||
|
@ -174,7 +172,8 @@ function main({ type, asyncMethod }) {
|
|||
|
||||
bench.http({
|
||||
path,
|
||||
connections
|
||||
connections,
|
||||
duration
|
||||
}, () => {
|
||||
close();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue