GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Backport removing let in for loop declaration by MylesBorins · Pull Request #9553 · nodejs/node

Conversation

@MylesBorins

@MylesBorins MylesBorins commented Nov 11, 2016

Copy link
Copy Markdown
Contributor
Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

lib, tools, test, streams

Description of change

This is a backport of a number of commits that remove the use of let in for loop declarations.

It starts with #8873 that removes all instances of let, followed by #9171 to fix a regression introduced in streams, and finally #9049 which adds a linting rule to avoid regressing.

These changes have been living on v6.x and v7.x for a while and did show a decent improvement in performance. I would imagine it will only be more noticeable for v4.x. If anyone from @nodejs/benchmarking wants to chime in here that would be awesome

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. tools Issues and PRs related to the tools directory. v4.x labels Nov 11, 2016
Myles Borins and others added 4 commits November 11, 2016 15:20
Myles Borins
lib: remove let from for loops
d7b9f36
This is a known de-opt. It may not be 100% necessary in all cases but it
seems like a decent enough idea to avoid it.

Ref: nodejs#9553
PR-URL: nodejs#8873
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Ilkka Myller <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@addaleax Myles Borins
streams: fix regression in unpipe()
c25eb61
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

Ref: nodejs#9553
PR-URL: nodejs#9171
Fixes: nodejs#9170
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Niels Nielsen Myles Borins
test: add regression test for unpipe()
a1d7201
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

Ref: nodejs#9553
PR-URL: nodejs#9171
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
@jalafel Myles Borins
tools: avoid let in for loops
d1d3379
This adds a new ESLint tool to check for let
declarations within the for, forIn, forOf expressions.

Fixes: nodejs#9045
Ref: nodejs#9553
Ref: nodejs#8873
PR-URL: nodejs#9049
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Prince John Wesley <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins
MylesBorins force-pushed the no-let-in-loops branch from 7b2d24f to d1d3379 Compare November 11, 2016 20:20
@MylesBorins MylesBorins added stream Issues and PRs related to Node.js streams. test Issues and PRs related to Node.js core tests and test infrastructure. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. and removed lib / src Issues and PRs involving general changes in the lib/ or src/ directories. labels Nov 11, 2016
@MylesBorins MylesBorins changed the title Backport let in for loop Backport removing let in for loop declaration Nov 11, 2016
@MylesBorins

MylesBorins commented Nov 11, 2016

Copy link
Copy Markdown
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/4823/

/cc @addaleax

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Nov 11, 2016
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

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.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
MylesBorins pushed a commit that referenced this pull request Nov 14, 2016
Myles Borins
lib: remove let from for loops
4238460
This is a known de-opt. It may not be 100% necessary in all cases but it
seems like a decent enough idea to avoid it.

Ref: #9553
PR-URL: #8873
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Ilkka Myller <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 14, 2016
@addaleax Myles Borins
streams: fix regression in unpipe()
9b9762c
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

Ref: #9553
PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 14, 2016
Niels Nielsen Myles Borins
test: add regression test for unpipe()
d9c3364
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

Ref: #9553
PR-URL: #9171
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 14, 2016
@jalafel Myles Borins
tools: avoid let in for loops
c8dccf2
This adds a new ESLint tool to check for let
declarations within the for, forIn, forOf expressions.

Fixes: #9045
Ref: #9553
Ref: #8873
PR-URL: #9049
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Prince John Wesley <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins

MylesBorins commented Nov 14, 2016

Copy link
Copy Markdown
Contributor Author

landed in 84849f1...c8dccf2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MylesBorins MylesBorins closed this Nov 14, 2016
@MylesBorins
MylesBorins deleted the no-let-in-loops branch November 14, 2017 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories. stream Issues and PRs related to Node.js streams. test Issues and PRs related to Node.js core tests and test infrastructure. tools Issues and PRs related to the tools directory.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@MylesBorins @addaleax @nodejs-github-bot @jalafel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.