Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
assert: improve error check#17574
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
assert: improve error check #17574
Uh oh!
There was an error while loading. Please reload this page.
Conversation
apapirovski left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add labels re: not landing on v6.x/v8.x as appropriate. Maybe even v9.x depending on when the optimizations in V8 occurred.
lib/internal/errors.js Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't a performance microoptimization, but rather an integrity check to avoid Object.create(Error.prototype) from being recognized as an Error.
apapirovskiDec 9, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I indeed did not think about this case. I also do not mind if it stays as it will not hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimothyGu would you like to keep it to be on the safe side about this or shall I just remove the part again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apapirovski Thanks for digging up the original PR. It was very informative. @BridgeAR Feel free to remove.
lpinca commented Dec 11, 2017
On Node.js 9.2.1 |
apapirovski commented Dec 12, 2017
This shouldn't land on v9.x unless V8 6.3 makes its way there. |
apapirovski commented Dec 14, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
lpinca commented Dec 14, 2017
@apapirovski I compared |
apapirovski commented Dec 14, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@lpinca Right, that makes sense. I assume @BridgeAR was talking about If this lands, it can probably land on both v8.x & v9.x because there doesn't seem to be a perf difference. |
lpinca commented Dec 14, 2017
I didn't test it but I assume current code is still faster when an error is passed. @apapirovski do you have some numbers at hand? |
apapirovski commented Dec 14, 2017
I would guess that it definitely is. The question is (probably) whether we want to keep around this type of code or clean it up. I would guess that |
lpinca commented Dec 14, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
It makes sense. Reading the discussion in https://github.com/nodejs/node/pull/15025/files it shouldn't probably have been added in the first place. |
BridgeAR commented Dec 16, 2017
That is correct. |
BridgeAR commented Dec 19, 2017
Ping @lpinca@apapirovski@TimothyGu@jasnell@maclover7 what do you think? |
lpinca commented Dec 19, 2017
Seems good to me, but the |
lpinca commented Dec 19, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
FWIW according to https://v8project.blogspot.it/2017/12/v8-release-64.html the |
BridgeAR commented Dec 26, 2017
@lpinca that was the change that reminded me about it (https://chromium.googlesource.com/v8/v8.git/+/bcee140617fe90e8c354394216225615b9558113). I am going to check if this specific case is actually better with instanceof after 6.4 landed or if |
c61bb73 to c4b51c1CompareBridgeAR commented Feb 17, 2018
So I just checked this again and the current solution is still faster on master. It is also faster on v.8 and v.9 but not on v.6. The performance divers depending on the input. But this is always faster than the current implementation. |
BridgeAR commented Feb 17, 2018
BridgeAR commented Feb 17, 2018
The commit message should be changed before this lands. |
BridgeAR commented Feb 28, 2018
Minor performance improvement.
BridgeAR commented Mar 2, 2018
CI before landing https://ci.nodejs.org/job/node-test-pull-request/13455/ |
Minor performance improvement. PR-URL: nodejs#17574 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BridgeAR commented Mar 6, 2018
Landed in b5825e1 |
Minor performance improvement. PR-URL: #17574 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Minor performance improvement. PR-URL: #17574 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Minor performance improvement. PR-URL: nodejs#17574 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
jasnell commented Aug 17, 2018
Should this be backported to 8.x? If so, we need a separate backport PR. |
With newer V8 versions instanceof checks became very fast and
we do not have to check for the property existence anymore.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
assert