Skip to content

Conversation

@yashLadha
Copy link
Contributor

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

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. labels Aug 17, 2020
@joyeecheungjoyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2020
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2020
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@Trott
Copy link
Member

@jasnell@joyeecheung There have been some small changes since your reviews. Can you re-review?

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand this comment. Is it supposed to mean "This is possible because we still have the whole string intact"? If so, it only makes sense in the context of this change. I don't think it explains the code well.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The intention of the comment is around the choice of using the start index for comparison. Maybe it can be written in a better way. I will work on it.

Copy link
Member

Choose a reason for hiding this comment

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

If the goal is to remove str.substr (presumably because it allocated memory), why not replace this with str.compare? Or does the compiler optimize this substr call away?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Not sure about the implementation of compare and how it handles the comparison and allocation but from a higher level point of view it seems valid.

Copy link
Member

Choose a reason for hiding this comment

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

compare returns an integer. If the strings are equal, the return value is 0.

@yashLadhayashLadhaforce-pushed the faster_basename branch 3 times, most recently from b3954ad to 34d7ff5CompareSeptember 6, 2020 04:39
Reduced the number of substring calls by 1 as it is a linear time complexity function. Thus having a larger path might lead to decrease in performance. Also removed unnecessary string allocation happening in the block.
@tniessentniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 6, 2020
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 6, 2020
@nodejs-github-bot

This comment has been minimized.

@tniessentniessen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 6, 2020
@aduh95aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 11, 2020
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 11, 2020
@nodejs-github-bot
Copy link
Collaborator

@github-actionsgithub-actionsbot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 11, 2020
@github-actions
Copy link
Contributor

Landed in 4cfa5df...2e4930b

nodejs-github-bot pushed a commit that referenced this pull request Oct 11, 2020
Reduced the number of substring calls by 1 as it is a linear time complexity function. Thus having a larger path might lead to decrease in performance. Also removed unnecessary string allocation happening in the block. PR-URL: #34808 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
@yashLadhayashLadha deleted the faster_basename branch October 12, 2020 00:36
MylesBorins pushed a commit that referenced this pull request Oct 14, 2020
Reduced the number of substring calls by 1 as it is a linear time complexity function. Thus having a larger path might lead to decrease in performance. Also removed unnecessary string allocation happening in the block. PR-URL: #34808 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Oct 14, 2020
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Reduced the number of substring calls by 1 as it is a linear time complexity function. Thus having a larger path might lead to decrease in performance. Also removed unnecessary string allocation happening in the block. PR-URL: nodejs#34808 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
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.c++Issues and PRs that require attention from people who are familiar with C++.fsIssues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@yashLadha@nodejs-github-bot@Trott@fhinkel@jasnell@tniessen@joyeecheung@aduh95