benchmark: added a test benchmark for worker

Wrote a sequential benchmark test for worker.
This is to make sure the benchmark for work runs properly.

PR-URL: https://github.com/nodejs/node/pull/23475
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Muzafar Umarov 2018-10-12 12:47:35 -04:00 committed by Anna Henningsen
parent ff3c56c792
commit 8059ff2f0b
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -0,0 +1,23 @@
'use strict';
const common = require('../common');
if (!common.enoughTestMem)
common.skip('Insufficient memory for Worker benchmark test');
// Because the worker benchmarks can run on different threads,
// this should be in sequential rather than parallel to make sure
// it does not conflict with tests that choose random available ports.
const runBenchmark = require('../common/benchmark');
runBenchmark('worker',
[
'n=1',
'sendsPerBroadcast=1',
'workers=1',
'payload=string'
],
{
NODEJS_BENCHMARK_ZERO_ALLOWED: 1
});