summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-08-19 12:55:24 -0700
committerRich Trott <rtrott@gmail.com>2017-08-23 22:34:59 -0700
commitfffc84a4174ad6ee7a06266e979672d38ec373d3 (patch)
tree5d51c6e0a90422ccd026fc7530964ace351a9b34 /benchmark
parenta36b5405029597ce09e15373a321c47930689c08 (diff)
downloadnode-new-fffc84a4174ad6ee7a06266e979672d38ec373d3.tar.gz
benchmark: fix dgram/bind-params.js benchmark
`benchmark/dgram/bind-params` exits with an error frequently in its current form because no error handler is applied. Add no-op error handlers to avoid the problem. ```console $ node benchmark/run.js --filter bind-params dgram dgram/bind-params.js dgram/bind-params.js address="true" port="true" n=10000: 193,347.42178656923 events.js:182 throw er; // Unhandled 'error' event ^ Error: bind ENFILE 0.0.0.0 at Object._errnoException (util.js:1041:11) at _exceptionWithHostPort (util.js:1064:20) at _handle.lookup (dgram.js:242:18) at _combinedTickCallback (internal/process/next_tick.js:141:11) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:611:11) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:598:3 $ ``` PR-URL: https://github.com/nodejs/node/pull/14948 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/dgram/bind-params.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/benchmark/dgram/bind-params.js b/benchmark/dgram/bind-params.js
index 92e9b7f85b..411bef98ad 100644
--- a/benchmark/dgram/bind-params.js
+++ b/benchmark/dgram/bind-params.js
@@ -10,6 +10,7 @@ const configs = {
};
const bench = common.createBenchmark(main, configs);
+const noop = () => {};
function main(conf) {
const n = +conf.n;
@@ -19,19 +20,27 @@ function main(conf) {
if (port !== undefined && address !== undefined) {
bench.start();
for (let i = 0; i < n; i++) {
- dgram.createSocket('udp4').bind(port, address).unref();
+ dgram.createSocket('udp4').bind(port, address)
+ .on('error', noop)
+ .unref();
}
bench.end(n);
} else if (port !== undefined) {
bench.start();
for (let i = 0; i < n; i++) {
- dgram.createSocket('udp4').bind(port).unref();
+ dgram.createSocket('udp4')
+ .bind(port)
+ .on('error', noop)
+ .unref();
}
bench.end(n);
} else if (port === undefined && address === undefined) {
bench.start();
for (let i = 0; i < n; i++) {
- dgram.createSocket('udp4').bind().unref();
+ dgram.createSocket('udp4')
+ .bind()
+ .on('error', noop)
+ .unref();
}
bench.end(n);
}