Pass SendCoinsRecipient (208 bytes) by reference#10964
Pass SendCoinsRecipient (208 bytes) by reference#10964jonasschnelli merged 1 commit intobitcoin:masterfrom
Conversation
|
@promag These two are the only structures over 128 bytes which are passed by value. Let me know if you find any counterexample that falsifies that claim :-) |
|
utACK 346d8b096e1a93d673ca6e8090ed3e6f53dd4be7 I'd be happy if you could document how you identified the refactorings you are doing (with the exact command used in case of static checkers) in the commit message. Do you have a document somewhere that details all of the checks you are doing? Would be handy to have them in one place. |
There was a problem hiding this comment.
Please don't pass this by reference. This was intentional in case any unique_ptr's end up being passed in. Please just std::move it in init instead.
There was a problem hiding this comment.
Thanks for the clarification! Removing!
There was a problem hiding this comment.
@theuni can you elaborate? Why worry about it when there is no unique_ptr inside now? Even if there was, passing the struct by const reference prevents Connman from taking ownership.
There was a problem hiding this comment.
@benma Setting the unique_ptr thing aside, generally speaking, I prefer to pass anything with allocated mem by value rather than const reference if I know that it's going to be stored by the caller.
For example, we know that Start() is going to keep a local copies of vSeedNodes/vWhiteBinds/etc. If you pass by const reference, you guarantee the copies. But if you pass by value, you give the caller the opportunity to std::move them in instead.
That said, #10977 changes this to a const reference also. I don't care too strongly, so I'll just shut up about it :)
There was a problem hiding this comment.
@theuni Didn't realize that I changed the same thing in two PRs - sorry :-)
346d8b0 to
ffc7b6d
Compare
|
Build error unrelated. May I request a re-build? :-) |
ffc7b6d to
d3d946a
Compare
|
trivial utACK d3d946a |
d3d946a Pass SendCoinsRecipient (208 bytes) by const reference (practicalswift) Pull request description: Pass `SendCoinsRecipient` (208 bytes) by reference. Avoid passing big parameters by value. Tree-SHA512: 504791f1b1c73badbc276db13b83e39695298d7d82a9db0e48d54e7ef02f1a8d276b0adfdece1ba1130cc214e2f0fa9a3100b5359d0ca0fe96558d3c9a786e6e
Summary: Completes T559 Backport of PR10964 bitcoin/bitcoin#10964 Test Plan: make check test_runner.py Reviewers: jasonbcox, Fabien, deadalnix, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Subscribers: teamcity, schancel Differential Revision: https://reviews.bitcoinabc.org/D2701
d3d946a Pass SendCoinsRecipient (208 bytes) by const reference (practicalswift) Pull request description: Pass `SendCoinsRecipient` (208 bytes) by reference. Avoid passing big parameters by value. Tree-SHA512: 504791f1b1c73badbc276db13b83e39695298d7d82a9db0e48d54e7ef02f1a8d276b0adfdece1ba1130cc214e2f0fa9a3100b5359d0ca0fe96558d3c9a786e6e
d3d946a Pass SendCoinsRecipient (208 bytes) by const reference (practicalswift) Pull request description: Pass `SendCoinsRecipient` (208 bytes) by reference. Avoid passing big parameters by value. Tree-SHA512: 504791f1b1c73badbc276db13b83e39695298d7d82a9db0e48d54e7ef02f1a8d276b0adfdece1ba1130cc214e2f0fa9a3100b5359d0ca0fe96558d3c9a786e6e
d3d946a Pass SendCoinsRecipient (208 bytes) by const reference (practicalswift) Pull request description: Pass `SendCoinsRecipient` (208 bytes) by reference. Avoid passing big parameters by value. Tree-SHA512: 504791f1b1c73badbc276db13b83e39695298d7d82a9db0e48d54e7ef02f1a8d276b0adfdece1ba1130cc214e2f0fa9a3100b5359d0ca0fe96558d3c9a786e6e
d3d946a Pass SendCoinsRecipient (208 bytes) by const reference (practicalswift) Pull request description: Pass `SendCoinsRecipient` (208 bytes) by reference. Avoid passing big parameters by value. Tree-SHA512: 504791f1b1c73badbc276db13b83e39695298d7d82a9db0e48d54e7ef02f1a8d276b0adfdece1ba1130cc214e2f0fa9a3100b5359d0ca0fe96558d3c9a786e6e
Pass
SendCoinsRecipient(208 bytes) by reference.Avoid passing big parameters by value.