| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
To copy the values of all enumerable own properties from- a source object to a target object, node still use- `util._extend`, though newer standard `Object.assign` is available. This is because `util._extend` is found to be faster than `Object.assign`. This benchmark test is to keep track of how performance compare.
|
|
||
| const bench = common.createBenchmark(main, { | ||
| type: ['util._extend', 'Object.assign', | ||
| 'util._extend', 'Object.assign'], |
There was a problem hiding this comment.
Why are there duplicates?
Sorry, something went wrong.
There was a problem hiding this comment.
Removed.
Sorry, something went wrong.
| if (conf.type === 'extend') { | ||
| fn = util._extend; | ||
| v8command = '%OptimizeFunctionOnNextCall(util._extend)'; | ||
| } else if (conf.type === 'assign') { |
There was a problem hiding this comment.
FYI: https://github.com/nodejs/node/blob/master/benchmark/common.js#L255
the benchmark/common.js now has a method for handling the details of v8 optimization for you. e.g.
function myMethod(a,b) {
/** ... **/
}
common.v8ForceOptimization(myMethod, 'a', 'b');
myMethod('a', 'b');
Sorry, something went wrong.
|
Couple of minor nits but LGTM if @mscdex is happy with it. |
Sorry, something went wrong.
| v8command = '%OptimizeFunctionOnNextCall(util._extend)'; | ||
| } else if (conf.type === 'assign') { | ||
| fn = Object.assign; | ||
| //Object.assign is built-in, cannot be optimized |
There was a problem hiding this comment.
Space needed after //.
Sorry, something went wrong.
|
One minor style nit, but otherwise LGTM |
Sorry, something went wrong.
fixed spacing nit.
|
Fixed the minor style. |
Sorry, something went wrong.
To copy the values of all enumerable own properties from- a source object to a target object, node still use- `util._extend`, though newer standard `Object.assign` is available. This is because `util._extend` is found to be faster than `Object.assign`. This benchmark test is to keep track of how performance compare. PR-URL: #7255 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
To copy the values of all enumerable own properties from- a source object to a target object, node still use- `util._extend`, though newer standard `Object.assign` is available. This is because `util._extend` is found to be faster than `Object.assign`. This benchmark test is to keep track of how performance compare. PR-URL: #7255 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
benchmark
Description of change
To copy the values of all enumerable properties from-
a source object to a target object, node still use-
util._extend, though newer standard Object.assign
is available. This is because util._extend is found to
be faster than Object.assign. This benchmark test is
to keep track of how performance compare.