Uh oh!
There was an error while loading. Please reload this page.
src: reduced substring calls - #34808
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Trott
commented
Aug 23, 2020
@jasnell@joyeecheung There have been some small changes since your reviews. Can you re-review? |
nodejs-github-bot
commented
Aug 23, 2020
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
compare returns an integer. If the strings are equal, the return value is 0.
b3954ad to
34d7ff5CompareReduced 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.
34d7ff5 to
ec75ce2Compare
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
Oct 11, 2020
Landed in 4cfa5df...2e4930b |
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>
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>
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>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes