-
Notifications
You must be signed in to change notification settings - Fork 176
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
refactor!: move AMVF and IVF config explicitly #2509
Conversation
I don't think it has performance implications. The move most likely is going to result in a regular copy anyway, but the compiler might end up optimizing this out the same way it does for the const ref. We also don't (or shouldn't) instantiate this very often (I think we do at this point, but only for convenience reasons) so I don't think it's a critical optimization. |
Should I just use a const ref then? |
Codecov Report
@@ Coverage Diff @@
## main #2509 +/- ##
=======================================
Coverage 49.59% 49.59%
=======================================
Files 473 473
Lines 26824 26824
Branches 12355 12355
=======================================
Hits 13304 13304
Misses 4753 4753
Partials 8767 8767
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
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.
Anyway, implicitly moving mutable references is not a good idea anyway, so let's do this.
This required minor compile fixes in Athena. |
I realized that we pass Should we do this here too? Or should we also use |
@felix-russo It doesn't really matter. If you pass a const ref and copy into the member in the constructor or you pass a copy and move it into the container. The const ref might be slightly more efficient, because the move for a POD is effectively a copy. But for config structs this should not be a concern. BUT: we should never pass a mutable ref and move that, because it moves from the source value that the caller holds, which is super unexpected. |
Title says it all!
Might be breaking as now
config
must be moved in the parent scope.It might be better to not move the
config
and pass it as a const reference, not sure though.