René's URL Explorer Experiment


Title: Decreased performance in code running in Temporal Dead Zone · Issue #12568 · nodejs/node · GitHub

Open Graph Title: Decreased performance in code running in Temporal Dead Zone · Issue #12568 · nodejs/node

X Title: Decreased performance in code running in Temporal Dead Zone · Issue #12568 · nodejs/node

Description: 7.9.0: Linux mitsos-XPS-13-9360 4.10.0-19-generic #21~16.04.1-Ubuntu SMP Fri Apr 7 08:20:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux: Subsystem: **I have created a detailed Stack Overflow question here so I will quote it here to get some ...

Open Graph Description: 7.9.0: Linux mitsos-XPS-13-9360 4.10.0-19-generic #21~16.04.1-Ubuntu SMP Fri Apr 7 08:20:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux: Subsystem: **I have created a detailed Stack Overflow question h...

X Description: 7.9.0: Linux mitsos-XPS-13-9360 4.10.0-19-generic #21~16.04.1-Ubuntu SMP Fri Apr 7 08:20:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux: Subsystem: **I have created a detailed Stack Overflow question h...

Opengraph URL: https://github.com/nodejs/node/issues/12568

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decreased performance in code running in Temporal Dead Zone","articleBody":"\u003c!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n* **7.9.0**:\r\n* **Linux mitsos-XPS-13-9360 4.10.0-19-generic #21~16.04.1-Ubuntu SMP Fri Apr 7 08:20:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux**:\r\n* **Subsystem**:\r\n\r\n\u003c!-- Enter your issue details below this comment. -->\r\n\r\n**I have created a detailed Stack Overflow question [here](http://stackoverflow.com/questions/43540849/javascript-temporal-dead-zone-nodejs-7-9-0-performance-decrease) so I will quote it here to get some answers since I do not know the internal mechanichs...\r\n\r\n**Quoted Question:**\r\n\r\nI have noticed in an other [question](http://stackoverflow.com/questions/37792934/why-is-let-slower-than-var-in-a-for-loop-in-nodejs) the performance difference in loops while using `let` and `var` variables declaration.\r\n\r\n\r\nThe initial  question is correctly answered that using `let` in the **for loop** is slower since `let` creates a new scope for each iteration to hold the value of `let` declared variable. More work to be done, so it is normal to be slower. Just as reference, I give the code and the results in NodeJS (7.9.0) execution time:\r\n\r\n*Please note that all javascript code below regards NodeJS version 7.9.0*\r\n\r\n**Regular Code:**\r\n\r\n    'use strict';\r\n    console.time('var');\r\n    for (var i = 0; i \u003c 100000000; i++) {}\r\n    console.timeEnd('var');\r\n    \r\n    \r\n    console.time('let');\r\n    for (let j = 0; j \u003c 100000000; j++) {}\r\n    console.timeEnd('let');\r\n\r\n**Output:**\r\n\r\n    var: 55.792ms\r\n    let: 247.123ms\r\n\r\nIn order to avoid the extra scope declaration for `j` in every iteration of the loop, we declare the `j` variable just before the loop. One would expect that this should now make the `let` loop performance match the one of `var`. **BUT NO!!!** This is the code and the result for reference:\r\n\r\n**Code with `let` defined before loop:**\r\n\r\n    'use strict';\r\n    console.time('var');\r\n    for (var i = 0; i \u003c 100000000; i++) {}\r\n    console.timeEnd('var');\r\n    \r\n    \r\n    console.time('let');\r\n    let j;\r\n    for (j = 0; j \u003c 100000000; j++) {}\r\n    console.timeEnd('let');\r\n\r\n**Output:**\r\n\r\n    var: 231.249ms\r\n\tlet: 233.485ms\r\n\r\nWe can see that, not only the `let` loop did not get any faster but also the `var` loop became as slow as the `let` one!!! The only explanation for this is that since we are not in any block or function, both variables are declared in the **global** module scope. However as referenced [here](http://exploringjs.com/es6/ch_variables.html#sec_temporal-dead-zone), the `let` declaration of the variable in the middle of the scope, creates a **temporal dead zone**, which leaves the variable `j` uninitialized, while the `var` initializes the variable as defined.\r\n\r\nSo running code in a temporal dead zone although the uninitialized variable is not referenced, must be quite slower....\r\n\r\nFinally to show the deference, we declare the `j` variable on top of the program to show the results of running it without the **temporal dead zone**.\r\n\r\n**Code without temporal dead zone:**\r\n\r\n    'use strict';\r\n    let j;\r\n    console.time('var');\r\n    for (var i = 0; i \u003c 100000000; i++) {}\r\n    console.timeEnd('var');\r\n    \r\n    \r\n    console.time('let');\r\n    for (j = 0; j \u003c 100000000; j++) {}\r\n    console.timeEnd('let');\r\n\r\n**Output:**\r\n\r\n\tvar: 55.586ms\r\n\tlet: 55.009ms\r\n\r\n**Now both `let` and `var` loops have similar optimized performance!**\r\n\r\nDoes anyone know whether my assumption about temporal dead zone performance is correct, or provide a different explanation???\r\n\r\n","author":{"url":"https://github.com/mitsos1os","@type":"Person","name":"mitsos1os"},"datePublished":"2017-04-21T11:16:09Z","url":"https://github.com/nodejs/node/issues/12568"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d472c20c-9734-ad91-ae02-ea43433612cf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB2DC:ABE51:66833E:855AEF:6AED2DDF
html-safe-nonce7f5adafff8154eb15619b6a17fc990a1bf9790c36adf384fcefb0b807d92af7e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkRDOkFCRTUxOjY2ODMzRTo4NTVBRUY6NkFFRDJEREYiLCJ2aXNpdG9yX2lkIjoiNzE4NzkyOTMwNDEyMzkxMTY0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac785ae2ebab89710aa87eee962f74c1fea5ecfe2529a316257aeb84ec2aa2cb4a
hovercard-subject-tagissue:223354109
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/12568/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2bb6bc3961ac552ebbe3e23030fb8080a61c599acc5af6a51e0cd133dafb6ad8/nodejs/node/issues/12568
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2bb6bc3961ac552ebbe3e23030fb8080a61c599acc5af6a51e0cd133dafb6ad8/nodejs/node/issues/12568
og:image:alt7.9.0: Linux mitsos-XPS-13-9360 4.10.0-19-generic #21~16.04.1-Ubuntu SMP Fri Apr 7 08:20:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux: Subsystem: **I have created a detailed Stack Overflow question h...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemitsos1os
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/12568#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F12568
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F12568
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/12568
Reloadhttps://github.com/nodejs/node/issues/12568
Reloadhttps://github.com/nodejs/node/issues/12568
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/12568
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/12568
Decreased performance in code running in Temporal Dead Zonehttps://github.com/nodejs/node/issues/12568#top
performanceIssues and PRs related to the performance of Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22performance%22
questionIssues asking questions about Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22question%22
v8 engineIssues and PRs related to the V8 dependency.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22v8%20engine%22
https://github.com/mitsos1os
mitsos1oshttps://github.com/mitsos1os
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#issue-223354109
add issue contributing section #21https://github.com/nodejs/node/pull/21
herehttp://stackoverflow.com/questions/43540849/javascript-temporal-dead-zone-nodejs-7-9-0-performance-decrease
questionhttp://stackoverflow.com/questions/37792934/why-is-let-slower-than-var-in-a-for-loop-in-nodejs
herehttp://exploringjs.com/es6/ch_variables.html#sec_temporal-dead-zone
vsemozhetbythttps://github.com/vsemozhetbyt
performanceIssues and PRs related to the performance of Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22performance%22
questionIssues asking questions about Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22question%22
v8 engineIssues and PRs related to the V8 dependency.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22v8%20engine%22
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#event-1052322300
https://github.com/vsemozhetbyt
vsemozhetbythttps://github.com/vsemozhetbyt
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#issuecomment-296173314
https://github.com/peterwmwong
peterwmwonghttps://github.com/peterwmwong
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#issuecomment-296175475
@caitphttps://github.com/caitp
v8/v8@267115dhttps://github.com/v8/v8/commit/267115da42779e56b2d624a3c3632e391b0ce268
v8/v8@e2670e8https://github.com/v8/v8/commit/e2670e80a5c4253ef7d06143c2e8b8afd8095d13
https://github.com/caitp
caitphttps://github.com/caitp
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#issuecomment-296182341
https://github.com/simonkcleung
simonkcleunghttps://github.com/simonkcleung
on Apr 21, 2017https://github.com/nodejs/node/issues/12568#issuecomment-296226784
http://stackoverflow.com/questions/37792934/why-is-let-slower-than-var-in-a-for-loop-in-nodejshttp://stackoverflow.com/questions/37792934/why-is-let-slower-than-var-in-a-for-loop-in-nodejs
https://github.com/Trott
Trotthttps://github.com/Trott
on Aug 2, 2017https://github.com/nodejs/node/issues/12568#issuecomment-319822878
https://github.com/targos
targoshttps://github.com/targos
on Aug 3, 2017https://github.com/nodejs/node/issues/12568#issuecomment-319899885
targoshttps://github.com/targos
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 3, 2017https://github.com/nodejs/node/issues/12568#event-1190933673
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/12568
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/12568
performanceIssues and PRs related to the performance of Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22performance%22
questionIssues asking questions about Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22question%22
v8 engineIssues and PRs related to the V8 dependency.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22v8%20engine%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.