url: use ES6 classes and move some functions into internals
Refactor url
module:
- Use ES6 classes
- Move some basic functions into
internal/url.js
,internal/util.js
Benchmark shows some difference:
improvement confidence p.value
url/legacy-vs-whatwg-url-get-prop.js n=100000 method="legacy" type="percent" 4.37 % * 3.913095e-02
url/legacy-vs-whatwg-url-parse.js n=100000 method="legacy" type="idn" -2.06 % ** 7.137298e-03
url/legacy-vs-whatwg-url-searchparams-serialize.js n=1000000 method="whatwg" type="manyblankpairs" 4.31 % ** 3.669254e-03
url/legacy-vs-whatwg-url-searchparams-serialize.js n=1000000 method="whatwg" type="multivalue" -1.62 % ** 6.376320e-03
url/legacy-vs-whatwg-url-serialize.js n=100000 method="whatwg" type="javascript" -1.75 % * 1.405245e-02
url/url-resolve.js n=100000 path="down" href="auth" 1.65 % ** 1.652042e-03
url/url-resolve.js n=100000 path="down" href="dot" 1.37 % * 3.546346e-02
url/url-resolve.js n=100000 path="down" href="short" 1.20 % * 2.452194e-02
url/url-resolve.js n=100000 path="foo/bar" href="dot" 1.44 % * 2.254629e-02
url/url-resolve.js n=100000 path="foo/bar" href="javascript" -1.52 % * 1.260775e-02
url/url-resolve.js n=100000 path="foo/bar" href="noscheme" 1.38 % * 1.595827e-02
url/url-resolve.js n=100000 path="sibling" href="auth" 1.63 % ** 6.451388e-03
url/url-resolve.js n=100000 path="sibling" href="dot" 1.88 % *** 8.029223e-04
url/url-resolve.js n=100000 path="sibling" href="javascript" 1.08 % * 3.110077e-02
url/url-resolve.js n=100000 path="sibling" href="noscheme" 1.00 % * 1.873547e-02
url/url-resolve.js n=100000 path="sibling" href="short" 1.62 % * 1.656235e-02
url/url-resolve.js n=100000 path="sibling" href="ws" 1.89 % ** 4.351491e-03
url/url-searchparams-iteration.js n=1000000 method="iterator" -1.86 % * 2.385322e-02
url/url-searchparams-read.js n=20000000 param="nonexistent" method="has" -2.63 % *** 4.735461e-15
url/whatwg-url-properties.js n=300000 prop="host" input="javascript" 2.24 % * 4.325197e-02
url/whatwg-url-properties.js n=300000 prop="hostname" input="javascript" 3.30 % * 2.371990e-02
url/whatwg-url-properties.js n=300000 prop="href" input="long" 1.91 % * 1.759479e-02
url/whatwg-url-properties.js n=300000 prop="href" input="short" 1.96 % ** 9.755675e-03
url/whatwg-url-properties.js n=300000 prop="href" input="ws" 1.53 % ** 3.213207e-03
url/whatwg-url-properties.js n=300000 prop="origin" input="javascript" 1.75 % * 2.283102e-02
url/whatwg-url-properties.js n=300000 prop="protocol" input="file" 6.08 % *** 2.254218e-07
url/whatwg-url-properties.js n=300000 prop="protocol" input="short" 2.46 % ** 3.231861e-03
url/whatwg-url-properties.js n=300000 prop="searchParams" input="javascript" 1.56 % * 2.220376e-02
url/whatwg-url-properties.js n=300000 prop="username" input="javascript" 2.66 % ** 1.543914e-03
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
url