dns: improve performance
Example results with the included benchmark file:
improvement confidence p.value
dns/lookup.js n=5000000 all="false" name="127.0.0.1" 83.78 % *** 1.619328e-41
I looked at the original commit where the "forced" async callback mechanism was added and I was not able to reproduce the sync callback issue with the tests included with that commit. My guess is that either c-ares changed or we have since manually taken care of such possible sync situations (e.g. empty hostnames or looking up an IP address).
I've also ran the dns tests in test/internet and there are no problems there either.
CI: https://ci.nodejs.org/job/node-test-pull-request/8343/
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
- dns