diff options
author | Weijia Wang <381152119@qq.com> | 2017-10-08 10:36:28 +0800 |
---|---|---|
committer | Refael Ackermann <refack@gmail.com> | 2017-10-10 17:16:36 -0400 |
commit | c1cd731abc38433d2deda9274cf7522fb651d52b (patch) | |
tree | bb2a8b61fd4d448f54aec9969a563b719bd7177f /lib/internal/url.js | |
parent | 6d9654b13de9f4f36317d4e3dd4096733712fc65 (diff) | |
download | android-node-v8-c1cd731abc38433d2deda9274cf7522fb651d52b.tar.gz android-node-v8-c1cd731abc38433d2deda9274cf7522fb651d52b.tar.bz2 android-node-v8-c1cd731abc38433d2deda9274cf7522fb651d52b.zip |
url: using util._extend for improving profermace
`Object.assign` is much slower than `util._extend` according to
the refs. This change is to convert the `Object.assign` to use
`util._extend` in url module for improving profermance.
PR-URL: https://github.com/nodejs/node/pull/16081
Refs: https://github.com/nodejs/CTC/issues/62
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index cf0271691a..18594a86fd 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -170,7 +170,7 @@ class URLSearchParams { return ctx.stylize('[Object]', 'special'); var separator = ', '; - var innerOpts = Object.assign({}, ctx); + var innerOpts = util._extend({}, ctx); if (recurseTimes !== null) { innerOpts.depth = recurseTimes - 1; } @@ -373,7 +373,7 @@ Object.defineProperties(URL.prototype, { value: function format(options) { if (options && typeof options !== 'object') throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'object'); - options = Object.assign({ + options = util._extend({ fragment: true, unicode: false, search: true, @@ -1244,7 +1244,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParamsIterator', { if (typeof recurseTimes === 'number' && recurseTimes < 0) return ctx.stylize('[Object]', 'special'); - const innerOpts = Object.assign({}, ctx); + const innerOpts = util._extend({}, ctx); if (recurseTimes !== null) { innerOpts.depth = recurseTimes - 1; } |