url: avoid instanceof for WHATWG URL
This PR replaces instanceof
checks with symbol checks. Various relevant results:
improvement confidence p.value
url/url-searchparams-read.js n=50000000 param="nonexistent" method="get" 195.08 % *** 5.548226e-41
url/url-searchparams-read.js n=50000000 param="nonexistent" method="getAll" 174.48 % *** 3.225875e-29
url/url-searchparams-read.js n=50000000 param="nonexistent" method="has" 190.68 % *** 9.000669e-32
url/url-searchparams-read.js n=50000000 param="one" method="get" 269.63 % *** 2.180791e-33
url/url-searchparams-read.js n=50000000 param="one" method="getAll" 111.73 % *** 1.724534e-25
url/url-searchparams-read.js n=50000000 param="one" method="has" 266.25 % *** 5.498456e-33
url/url-searchparams-read.js n=50000000 param="three" method="get" 203.56 % *** 2.754902e-45
url/url-searchparams-read.js n=50000000 param="three" method="getAll" 108.95 % *** 1.790912e-35
url/url-searchparams-read.js n=50000000 param="three" method="has" 198.65 % *** 1.896093e-32
url/url-searchparams-read.js n=50000000 param="two" method="get" 248.88 % *** 4.737990e-41
url/url-searchparams-read.js n=50000000 param="two" method="getAll" 112.93 % *** 2.182157e-31
url/url-searchparams-read.js n=50000000 param="two" method="has" 224.41 % *** 2.056153e-30
url/whatwg-url-properties.js n=10000000 prop="origin" input="auth" 12.59 % ** 0.0035532598
url/whatwg-url-properties.js n=10000000 prop="origin" input="dot" 10.53 % ** 0.0041671062
url/whatwg-url-properties.js n=10000000 prop="origin" input="file" 72.86 % *** 0.0004049447
url/whatwg-url-properties.js n=10000000 prop="origin" input="idn" 5.76 % 0.1494657794
url/whatwg-url-properties.js n=10000000 prop="origin" input="javascript" 54.73 % ** 0.0018129659
url/whatwg-url-properties.js n=10000000 prop="origin" input="long" 10.20 % * 0.0429791847
url/whatwg-url-properties.js n=10000000 prop="origin" input="percent" 1.84 % 0.3920201593
url/whatwg-url-properties.js n=10000000 prop="origin" input="short" 11.54 % *** 0.0001064664
url/whatwg-url-properties.js n=10000000 prop="origin" input="ws" 10.64 % ** 0.0074980105
CI: https://ci.nodejs.org/job/node-test-pull-request/6707/
/cc @nodejs/url
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
- url-whatwg