-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It appears that either c-ares no longer calls callbacks synchronously or we have since explicitly taken care of the scenarios in which c-ares would call callbacks synchronously (e.g. resolving an IP address or an empty hostname). Therefore we no longer need to have machinery in place to handle possible synchronous callback invocation. This improves performance significantly. PR-URL: #13261 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
2 changed files
with
44 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const lookup = require('dns').lookup; | ||
|
||
const bench = common.createBenchmark(main, { | ||
name: ['', '127.0.0.1', '::1'], | ||
all: [true, false], | ||
n: [5e6] | ||
}); | ||
|
||
function main(conf) { | ||
const name = conf.name; | ||
const n = +conf.n; | ||
const all = !!conf.all; | ||
var i = 0; | ||
|
||
if (all) { | ||
const opts = { all: true }; | ||
bench.start(); | ||
(function cb(err, results) { | ||
if (i++ === n) { | ||
bench.end(n); | ||
return; | ||
} | ||
lookup(name, opts, cb); | ||
})(); | ||
} else { | ||
bench.start(); | ||
(function cb(err, result) { | ||
if (i++ === n) { | ||
bench.end(n); | ||
return; | ||
} | ||
lookup(name, cb); | ||
})(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters