Uh oh!
There was an error while loading. Please reload this page.
Revert "timers: refactor to use optional chaining" - #38245
Conversation
This reverts commit d8f535b.
Flarna
commented
Apr 15, 2021
Should we report this towards v8? |
ronag
commented
Apr 15, 2021
Yea this seems like a V8 issue. @nodejs/v8 |
nodejs-github-bot
commented
Apr 15, 2021
mcollina
commented
Apr 15, 2021
cc @nodejs/tsc |
targos
commented
Apr 15, 2021
I wanted to prove it with a benchmark and open a V8 issue but it seems optional chaining is mostly faster (at least with V8 8.9): https://jsben.ch/BwkJK |
@mcollina: What node version were you trying this on? |
mcollina
commented
Apr 15, 2021
I have literally no clue why, but without optional chaining those function calls get inlined. Those flamegraphs come from master. |
targos
commented
Apr 15, 2021
That's a good point, thanks. I'll try to do a different benchmark to show that optional chaining prevents inlining. |
nodejs-github-bot
commented
Apr 15, 2021
nodejs-github-bot
commented
Apr 16, 2021
targos
commented
Apr 16, 2021
It's not that easy. Everything gets inlined with this example: 'use strict';functiongetPropClassic(obj){returnobj&&obj.prop;}functiongetPropOptional(obj){returnobj?.prop;}constobj={prop: 42};functiontestGetPropClassic(obj){returngetPropClassic(obj);}functiontestGetPropOptional(obj){returngetPropOptional(obj);}for(leti=0;i<1e6;i++){testGetPropClassic(obj);testGetPropOptional(obj);} |
jasnell
commented
Apr 16, 2021
@targos I'm curious... Can you try that example but with obj replaced with a class with a getter? classObj{getprop(){return42;}}constobj=newObj()Also, let's see what happens when you alternate calls between the argument being |
mcollina
commented
Apr 19, 2021
"Build from tarball / test-tarball-linux (pull_request) " keeps failing. Is that required to pass for this landing? cc @BethGriggs |
BethGriggs
commented
Apr 19, 2021
Failure is |
BethGriggs
commented
Apr 19, 2021
I hadn't appreciated before that GH actions do not rebase. fc20e83 was the fix for the failure seen here ( |
This reverts commit d8f535b. PR-URL: #38245 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs
commented
Apr 19, 2021
Landed in a0261d2 |


This reverts commit d8f535b.
As part of #37937, I tracked down a regression introduced by #36767.
With optional chaining:
Without optional chanining:
This sits in the hot path for HTTP.
I will recommend caution in adopting optional chaining in other areas of the Node.js.