FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

events: simplify stack compare function by BridgeAR · Pull Request #24744 · nodejs/node · GitHub

/ node Public

events: simplify stack compare function - #24744

Closed
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:simplify-longestSeqContainedIn
Closed

events: simplify stack compare function#24744
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:simplify-longestSeqContainedIn

Conversation

Copy link
Copy Markdown
Member

This simplifies the longestSeqContainedIn() logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.
BridgeAR requested a review from addaleax November 30, 2018 13:44

Copy link
Copy Markdown
Collaborator

nodejs-github-bot added the events Issues and PRs related to the events subsystem / EventEmitter. label Nov 30, 2018
Comment thread lib/events.js Outdated
Comment thread lib/events.js
return [len, i];
}
if (matches)
return [ len, i, j ];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

And for the same reason, returning j might not be used in this specific setup, but it’s part of having this be a more generic function.

BridgeAR Nov 30, 2018
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

pos translates to the former j but I recommend to change the signature when necessary and not to keep code in here that is currently unused.

Comment thread lib/events.js

BridgeAR commented Dec 2, 2018

Copy link
Copy Markdown
Member Author

Ping @addaleax

BridgeAR commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

This needs some reviews.

BridgeAR commented Dec 5, 2018

Copy link
Copy Markdown
Member Author

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you do a CITGM run?

Comment thread lib/events.js
// Returns the length and line number of the first sequence of `a` that fully
// appears in `b` with a length of at least 4.
function identicalSequenceRange(a, b) {
for (var i = 0; i < a.length - 3; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I would cache a.length - 3 in a variable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I expect the value to be constant fold (but I did not check).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

a could be quite big, and it used to be slightly faster to cache the value if it's computed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

a should normally be small (we currently only use this for stack frames) and this implementation should also be faster than the one before. If it's about performance, I could save a couple comparisons by using a simple for loop instead of indexOf (currently I check until the last entry but the last three entries are not interesting).

@bmeurer do values like these get constant fold?

BridgeAR commented Dec 8, 2018
edited
Loading

Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member Author

@mcollina nothing showed up in CITGM (most failures are related due to some windows issues and others to removed V8 functions, the rest is also known).

Copy link
Copy Markdown
Member Author

I know this is nothing important but it would still be great to get some reviews here. This PR is open since 14 days and there was neither a +1, nor a -1.

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Dec 14, 2018

Trott commented Dec 16, 2018

Copy link
Copy Markdown
Member

Not strictly required, but it would be great to get another review on this one. @addaleax @bnoordhuis @apapirovski @mscdex (There's not @nodejs/events team, so that list is assembled from very imperfect and superficial use of git shortlog.)

BridgeAR added a commit to BridgeAR/node that referenced this pull request Dec 19, 2018
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: nodejs#24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

Copy link
Copy Markdown
Member Author

Landed in a76750b

BridgeAR closed this Dec 19, 2018
BridgeAR added the performance Issues and PRs related to the performance of Node.js. label Dec 23, 2018
MylesBorins pushed a commit that referenced this pull request Dec 25, 2018
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: #24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins mentioned this pull request Dec 25, 2018
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: nodejs#24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 17, 2019
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: #24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 28, 2019
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: #24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BethGriggs mentioned this pull request May 1, 2019
BethGriggs pushed a commit that referenced this pull request May 10, 2019
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: #24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 16, 2019
This simplifies the `longestSeqContainedIn()` logic by checking for
the first identical occurance of at least three frames instead of
the longest one.
It also removes an unused argument.

PR-URL: #24744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
BridgeAR deleted the simplify-longestSeqContainedIn branch January 20, 2020 11:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. events Issues and PRs related to the events subsystem / EventEmitter. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL