Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: remove internal `util._extends()` usage #25105

Closed

Conversation

@BridgeAR
Copy link
Member

commented Dec 18, 2018

This removes all internal calls to the deprecated _extends()
function. It is slower than Object.assign() and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

Benchmark with 11.4:

// node benchmark/es/spread-assign.js 
es/spread-assign.js n=1000000 count=5 method="spread": 36,495,416.66835458
es/spread-assign.js n=1000000 count=10 method="spread": 31,889,730.923060697
es/spread-assign.js n=1000000 count=20 method="spread": 151,930.52448171392
es/spread-assign.js n=1000000 count=5 method="assign": 9,476,496.804852217
es/spread-assign.js n=1000000 count=10 method="assign": 4,704,920.0252048215
es/spread-assign.js n=1000000 count=20 method="assign": 123,309.56193177585
es/spread-assign.js n=1000000 count=5 method="_extend": 5,076,862.324845331
es/spread-assign.js n=1000000 count=10 method="_extend": 2,359,288.3170930305
es/spread-assign.js n=1000000 count=20 method="_extend": 382,746.2281006062
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 18, 2018

@mscdex

This comment has been minimized.

Copy link
Contributor

commented Dec 18, 2018

Why is _extend faster than spread at count=20?

@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 18, 2018

@mscdex please have a look at my comment here https://bugs.chromium.org/p/v8/issues/detail?id=7611#c27. There is a weird cliff from 19 to 20 properties when running the benchmark for the first time. The average is definitely going to be faster.

@targos
targos approved these changes Dec 18, 2018
lib/https.js Outdated Show resolved Hide resolved
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 18, 2018

@jasnell
Copy link
Member

left a comment

Definitely think this is the right way to go but this definitely should not be backported to older Node.js versions where the same performance improvements haven't been made in V8.

@bmeurer ... any insights on the speed of the > 20 case?

@Trott

This comment has been minimized.

Copy link
Member

commented Dec 18, 2018

AIX failure on CI reported at #25047.

Linux container failure reported at #25070.

Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19660/ ✔️

@bmeurer

This comment has been minimized.

Copy link
Member

commented Dec 18, 2018

@jasnell I guess @caitp could help here?

@lpinca
lpinca approved these changes Dec 18, 2018
BridgeAR added a commit to BridgeAR/node that referenced this pull request Dec 20, 2018
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: nodejs#25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2018

Landed in d4c91f2

@MylesBorins

This comment has been minimized.

Copy link
Member

commented Dec 25, 2018

This doesn't land cleanly on v11.x, would someone be willing to backport?

@targos targos added this to Backport requested in v11.x Dec 28, 2018

BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 9, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: nodejs#25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 9, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: nodejs#25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@BridgeAR BridgeAR referenced this pull request Jan 9, 2019
4 of 4 tasks complete
BridgeAR added a commit that referenced this pull request Jan 10, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: #25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

@BridgeAR BridgeAR moved this from Backport requested to Backported in v11.x Jan 10, 2019

addaleax added a commit that referenced this pull request Jan 14, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: #25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
refack added a commit to refack/node that referenced this pull request Jan 14, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: nodejs#25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@BridgeAR BridgeAR referenced this pull request Jan 16, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
lib: remove internal `util._extends()` usage
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.

PR-URL: nodejs#25105
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MylesBorins MylesBorins referenced this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
10 participants
You can’t perform that action at this time.