We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2948e96 commit f98679fCopy full SHA for f98679f
benchmark/dns/lookup-promises.js
@@ -0,0 +1,31 @@
1
+'use strict';
2
+
3
+const common = require('../common.js');
4
+const { lookup } = require('dns').promises;
5
6
+const bench = common.createBenchmark(main, {
7
+ name: ['127.0.0.1', '::1'],
8
+ all: ['true', 'false'],
9
+ n: [5e6]
10
+});
11
12
+function main({ name, n, all }) {
13
+ if (all === 'true') {
14
+ const opts = { all: true };
15
+ bench.start();
16
+ (async function cb() {
17
+ for (let i = 0; i < n; i++) {
18
+ await lookup(name, opts);
19
+ }
20
+ })();
21
+ bench.end(n);
22
+ } else {
23
24
25
26
+ await lookup(name);
27
28
29
30
31
+}
0 commit comments