| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
This wasn't a performance microoptimization, but rather an integrity check to avoid Object.create(Error.prototype) from being recognized as an Error.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
I indeed did not think about this case. I also do not mind if it stays as it will not hurt.
Sorry, something went wrong.
There was a problem hiding this comment.
@TimothyGu would you like to keep it to be on the safe side about this or shall I just remove the part again?
Sorry, something went wrong.
There was a problem hiding this comment.
@apapirovski Thanks for digging up the original PR. It was very informative. @BridgeAR Feel free to remove.
Sorry, something went wrong.
|
On Node.js 9.2.1 istanceof is still slow, when was it optimized? |
Sorry, something went wrong.
|
This shouldn't land on v9.x unless V8 6.3 makes its way there. |
Sorry, something went wrong.
|
Hmm, does anyone have a relevant benchmark for this? Doing some quick testing in repl indicates this might potentially be OK even on 8.x... cc @lpinca @BridgeAR |
Sorry, something went wrong.
|
@apapirovski I compared instanceof Error and err.stack using https://benchmarkjs.com/ before writing that comment above and it was a lot slower. |
Sorry, something went wrong.
|
@lpinca Right, that makes sense. I assume @BridgeAR was talking about instanceof not being prohibitively slow anymore rather than faster or as fast than the check above. It seems comparable to typeof now whereas it used to be much slower. If this lands, it can probably land on both v8.x & v9.x because there doesn't seem to be a perf difference. |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
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 instanceof is not going to be a bottleneck here. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
That is correct. instanceof got relatively fast in general since Turbofan landed. I do not remember exactly when. I just stumbled upon this part and did not like it very much. After running some benchmarks I actually decided to take a different way though and optimize it properly. The new code should be faster in all cases and it is also faster in the general case compared to instanceof. |
Sorry, something went wrong.
|
Ping @lpinca @apapirovski @TimothyGu @jasnell @maclover7 what do you think? |
Sorry, something went wrong.
|
Seems good to me, but the in operator wasn't very fast, not sure if it is now. |
Sorry, something went wrong.
|
FWIW according to https://v8project.blogspot.it/2017/12/v8-release-64.html the instanceof operator is 3.6 times faster on V8 6.4 |
Sorry, something went wrong.
|
@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 in is still faster. When I ran my benchmarks the current implementation was still better than other options. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
Sorry, something went wrong.
|
The commit message should be changed before this lands. |
Sorry, something went wrong.
|
Ping @lpinca @apapirovski @jasnell @TimothyGu @maclover7 PTAL |
Sorry, something went wrong.
Minor performance improvement.
|
CI before landing https://ci.nodejs.org/job/node-test-pull-request/13455/ |
Sorry, something went wrong.
Minor performance improvement. PR-URL: nodejs#17574 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Minor performance improvement. PR-URL: #17574 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Minor performance improvement. PR-URL: #17574 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Minor performance improvement. PR-URL: nodejs#17574 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
|
Should this be backported to 8.x? If so, we need a separate backport PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
With newer V8 versions instanceof checks became very fast and
we do not have to check for the property existence anymore.
Checklist
Affected core subsystem(s)
assert