lib: replace util._extend with object.assign#7208
lib: replace util._extend with object.assign#7208suryagh wants to merge 1 commit intonodejs:masterfrom
Conversation
`Object.assign` is built-in and has slight performance advantage- over the polyfill `_extend`. One thing to keep an eye is that `._extend` used to silently fails- while `assign` throws an error.
Do you have some benchmarks to back that up? That wasn't the case, as of #4593. |
|
Also see this similar PR that was submitted just the other week. |
|
I will close this However, would like to hear if anyone has any thoughts on the benchmark findings using the attached script. |
I think it was the nature of the data you were operating on. I switched to It might be good to have a benchmark in the repo for this, since it keeps coming up. |
|
@cjihrig this is interesting. With your |
|
@suryagh can I suggest opening a PR to create a benchmark for this? cc: @nodejs/benchmarking |
|
@cjihrig will do. |
Checklist
make -j4 test(UNIX) orvcbuild test nosign(Windows) passesAffected core subsystem(s)
http, tls, child-process, cluster, domain, fs, https, tty
Description of change
Object.assignis built-in and has some performance advantage-over the polyfill.
One thing to keep an eye is that
_extendused to fail silently-while
assignthrows an error. Let me know if there are any concerns-or if the
prneed to be split based on the components.