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

src: reduced substring calls by yashLadha · Pull Request #34808 · nodejs/node · GitHub

/ node Public

src: reduced substring calls - #34808

Closed
yashLadha wants to merge 1 commit into
nodejs:masterfrom
yashLadha:faster_basename
Closed

src: reduced substring calls#34808
yashLadha wants to merge 1 commit into
nodejs:masterfrom
yashLadha:faster_basename

Conversation

Copy link
Copy Markdown
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-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
joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2020
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2020

This comment has been minimized.

This comment has been minimized.

Trott commented Aug 23, 2020

Copy link
Copy Markdown
Member

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

Trott requested review from jasnell and joyeecheung August 23, 2020 11:21

Copy link
Copy Markdown
Collaborator

Comment thread src/node_file.cc Outdated

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 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
Copy Markdown
Contributor 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

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.

Comment thread src/node_file.cc Outdated

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

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
Copy Markdown
Contributor 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

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
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

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

yashLadha force-pushed the faster_basename branch 3 times, most recently from b3954ad to 34d7ff5 Compare September 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.
tniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 6, 2020
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 6, 2020

This comment has been minimized.

tniessen added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Sep 6, 2020
aduh95 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-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 11, 2020

Copy link
Copy Markdown
Collaborator

github-actions Bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 11, 2020

Copy link
Copy Markdown
Contributor

Landed in 4cfa5df...2e4930b

github-actions Bot closed this Oct 11, 2020
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 <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
yashLadha 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 <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
MylesBorins 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 <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL