-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: prevent extra copies of TimerWrap::TimerCb
#40665
Merged
nodejs-github-bot
merged 1 commit into
nodejs:master
from
RaisinTen:src/prevent-extra-copies-of-TimerWrap-TimerCb
Nov 12, 2021
Merged
src: prevent extra copies of TimerWrap::TimerCb
#40665
nodejs-github-bot
merged 1 commit into
nodejs:master
from
RaisinTen:src/prevent-extra-copies-of-TimerWrap-TimerCb
Nov 12, 2021
Conversation
This file contains 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
nodejs-github-bot
added
c++
Issues and PRs that require attention from people who are familiar with C++.
lib / src
Issues and PRs related to general changes in the lib or src directory.
needs-ci
PRs that need a full CI run.
labels
Oct 30, 2021
This comment has been minimized.
This comment has been minimized.
34 tasks
This comment has been minimized.
This comment has been minimized.
addaleax
approved these changes
Oct 31, 2021
38 tasks
RaisinTen
added
the
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
label
Nov 1, 2021
35 tasks
JungMinu
approved these changes
Nov 2, 2021
I noticed that we were taking `TimerCb` as a `const&` and then copying that into the member. This is completely fine when the constructor is called with an lvalue. However, when called with an rvalue, we can allow the `std::function` to be moved into the member instead of falling back to a copy, so I changed the constructors to take in universal references. Also, `std::function` constructors can take in multiple arguments, so I further modified the constructors to use variadic templates. Signed-off-by: Darshan Sen <[email protected]>
RaisinTen
force-pushed
the
src/prevent-extra-copies-of-TimerWrap-TimerCb
branch
from
November 2, 2021 15:12
6047d0a
to
bc7efeb
Compare
This comment has been minimized.
This comment has been minimized.
42 tasks
This comment has been minimized.
This comment has been minimized.
Closed
This was referenced Nov 4, 2021
I had to rebase on top of #40684 to fix the flaky tests. Can this get another review plz? |
RaisinTen
added
the
commit-queue
Add this label to land a pull request using GitHub Actions.
label
Nov 7, 2021
github-actions
bot
removed
the
commit-queue
Add this label to land a pull request using GitHub Actions.
label
Nov 7, 2021
github-actions
bot
added
the
commit-queue-failed
An error occurred while landing this pull request using GitHub Actions.
label
Nov 7, 2021
Commit Queue failed- Loading data for nodejs/node/pull/40665 ✔ Done loading data for nodejs/node/pull/40665 ----------------------------------- PR info ------------------------------------ Title src: prevent extra copies of `TimerWrap::TimerCb` (#40665) Author Darshan Sen (@RaisinTen) Branch RaisinTen:src/prevent-extra-copies-of-TimerWrap-TimerCb -> nodejs:master Labels c++, lib / src, author ready Commits 1 - src: prevent extra copies of `TimerWrap::TimerCb` Committers 1 - Darshan Sen PR-URL: https://github.com/nodejs/node/pull/40665 Reviewed-By: Anna Henningsen Reviewed-By: Minwoo Jung ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/40665 Reviewed-By: Anna Henningsen Reviewed-By: Minwoo Jung -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - src: prevent extra copies of `TimerWrap::TimerCb` ℹ This PR was created on Sat, 30 Oct 2021 15:56:09 GMT ✔ Approvals: 2 ✔ - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/40665#pullrequestreview-793747833 ✔ - Minwoo Jung (@JungMinu): https://github.com/nodejs/node/pull/40665#pullrequestreview-794777797 ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2021-11-03T13:44:37Z: https://ci.nodejs.org/job/node-test-pull-request/40683/ - Querying data for job/node-test-pull-request/40683/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/1431079248 |
aduh95
approved these changes
Nov 7, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM
aduh95
added
commit-queue
Add this label to land a pull request using GitHub Actions.
and removed
commit-queue-failed
An error occurred while landing this pull request using GitHub Actions.
labels
Nov 7, 2021
46 tasks
nodejs-github-bot
removed
the
commit-queue
Add this label to land a pull request using GitHub Actions.
label
Nov 12, 2021
Landed in 2d368da |
targos
pushed a commit
that referenced
this pull request
Nov 21, 2021
I noticed that we were taking `TimerCb` as a `const&` and then copying that into the member. This is completely fine when the constructor is called with an lvalue. However, when called with an rvalue, we can allow the `std::function` to be moved into the member instead of falling back to a copy, so I changed the constructors to take in universal references. Also, `std::function` constructors can take in multiple arguments, so I further modified the constructors to use variadic templates. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #40665 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams
pushed a commit
that referenced
this pull request
Jan 30, 2022
I noticed that we were taking `TimerCb` as a `const&` and then copying that into the member. This is completely fine when the constructor is called with an lvalue. However, when called with an rvalue, we can allow the `std::function` to be moved into the member instead of falling back to a copy, so I changed the constructors to take in universal references. Also, `std::function` constructors can take in multiple arguments, so I further modified the constructors to use variadic templates. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #40665 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams
pushed a commit
that referenced
this pull request
Feb 1, 2022
I noticed that we were taking `TimerCb` as a `const&` and then copying that into the member. This is completely fine when the constructor is called with an lvalue. However, when called with an rvalue, we can allow the `std::function` to be moved into the member instead of falling back to a copy, so I changed the constructors to take in universal references. Also, `std::function` constructors can take in multiple arguments, so I further modified the constructors to use variadic templates. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #40665 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Merged
codebytere
added a commit
to electron/electron
that referenced
this pull request
Feb 10, 2022
codebytere
added a commit
to electron/electron
that referenced
this pull request
Mar 9, 2022
codebytere
added a commit
to electron/electron
that referenced
this pull request
Mar 17, 2022
jkleinsc
pushed a commit
to electron/electron
that referenced
this pull request
Mar 23, 2022
* chore: bump node in DEPS to v16.14.0 * src: add flags for controlling process behavior nodejs/node#40339 * src: add x509.fingerprint512 to crypto module nodejs/node#39809 * deps: upgrade to libuv 1.43.0 nodejs/node#41398 * chore: fixup patch indices * chore: add missing filenames nodejs/node#39283 nodejs/node#40665 * crypto: trim input for NETSCAPE_SPKI_b64_decode nodejs/node#40757 * chore: update patches * chore: bump node in DEPS to v16.14.1 * tools: enable no-empty ESLint rule nodejs/node#41831 * chore: update patches * chore: update patches * chore: bump node in DEPS to v16.14.2 * chore: update patches Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <[email protected]> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
bavulapati
pushed a commit
to bavulapati/electron
that referenced
this pull request
Apr 29, 2022
* chore: bump node in DEPS to v16.14.0 * src: add flags for controlling process behavior nodejs/node#40339 * src: add x509.fingerprint512 to crypto module nodejs/node#39809 * deps: upgrade to libuv 1.43.0 nodejs/node#41398 * chore: fixup patch indices * chore: add missing filenames nodejs/node#39283 nodejs/node#40665 * crypto: trim input for NETSCAPE_SPKI_b64_decode nodejs/node#40757 * chore: update patches * chore: bump node in DEPS to v16.14.1 * tools: enable no-empty ESLint rule nodejs/node#41831 * chore: update patches * chore: update patches * chore: bump node in DEPS to v16.14.2 * chore: update patches Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <[email protected]> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
khalwa
pushed a commit
to solarwindscloud/electron
that referenced
this pull request
Feb 22, 2023
* chore: bump node in DEPS to v16.14.0 * src: add flags for controlling process behavior nodejs/node#40339 * src: add x509.fingerprint512 to crypto module nodejs/node#39809 * deps: upgrade to libuv 1.43.0 nodejs/node#41398 * chore: fixup patch indices * chore: add missing filenames nodejs/node#39283 nodejs/node#40665 * crypto: trim input for NETSCAPE_SPKI_b64_decode nodejs/node#40757 * chore: update patches * chore: bump node in DEPS to v16.14.1 * tools: enable no-empty ESLint rule nodejs/node#41831 * chore: update patches * chore: update patches * chore: bump node in DEPS to v16.14.2 * chore: update patches Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <[email protected]> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
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 pending requests for changes, and a CI started.
c++
Issues and PRs that require attention from people who are familiar with C++.
lib / src
Issues and PRs related to general changes in the lib or src directory.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that we were taking
TimerCb
as aconst&
and then copyingthat into the member. This is completely fine when the constructor is
called with an lvalue. However, when called with an rvalue, we can allow
the
std::function
to be moved into the member instead of falling backto a copy, so I changed the constructors to take in universal
references. Also,
std::function
constructors can take in multiplearguments, so I further modified the constructors to use variadic
templates.
Signed-off-by: Darshan Sen [email protected]