Skip to content

Conversation

@BridgeAR
Copy link
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.
@nodejs-github-botnodejs-github-bot added the events Issues and PRs related to the events subsystem / EventEmitter. label Nov 30, 2018
return[len,i];
}
if(matches)
return[len,i,j];
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
MemberAuthor

@BridgeARBridgeARNov 30, 2018

Choose a reason for hiding this comment

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

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.

@BridgeAR
Copy link
MemberAuthor

Ping @addaleax

@BridgeAR
Copy link
MemberAuthor

This needs some reviews.

@BridgeAR
Copy link
MemberAuthor

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

Can you do a CITGM run?

// Returns the length and line number of the first sequence of `a` that fully
// appears in `b` with a length of at least 4.
functionidenticalSequenceRange(a,b){
for(vari=0;i<a.length-3;i++){
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

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
Copy link
MemberAuthor

@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).

@BridgeAR
Copy link
MemberAuthor

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.

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 14, 2018
@Trott
Copy link
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 <[email protected]>
@BridgeAR
Copy link
MemberAuthor

Landed in a76750b

@BridgeARBridgeAR 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 <[email protected]>
@MylesBorinsMylesBorins 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
@BethGriggsBethGriggs 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 <[email protected]>
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 <[email protected]>
@BridgeARBridgeAR deleted the simplify-longestSeqContainedIn branch January 20, 2020 11:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.eventsIssues and PRs related to the events subsystem / EventEmitter.performanceIssues and PRs related to the performance of Node.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@BridgeAR@nodejs-github-bot@Trott@mcollina@addaleax@targos