-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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: Remove unused includes from wallet.cpp #28200
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
🎉 |
Concept ACK |
fa43d8a
to
fa8357c
Compare
fa31838
to
ccccbd8
Compare
Thanks, force pushed to fix the linter and made the commit hash start with cccc |
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.
Code review ACK ccccbd8
ccccbd8
to
fa89408
Compare
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.
ACK fa89408
#include <kernel/mempool_entry.h> // IWYU pragma: export | ||
#include <kernel/mempool_limits.h> // IWYU pragma: export | ||
#include <kernel/mempool_options.h> // IWYU pragma: export | ||
#include <kernel/mempool_removal_reason.h> // IWYU pragma: export |
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.
It seems IWYU pragma: export
causes:
txmempool.h should add these lines:
...
#include "kernel/mempool_limits.h"
#include "kernel/mempool_options.h"
#include "kernel/mempool_removal_reason.h" // for MemPoolRemovalReason (ptr only)
...
Perhaps, a better solution is to use contrib/devtools/iwyu/bitcoin.core.imp
.
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.
Yes, I am aware, but I think this bug should be reported to IWYU, or is it not a bug?
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.
I think this bug should be reported to IWYU...
Concept ACK. I didn't review the includes changes in detail, but the move makes sense to me. And I'm always up for one-data-structure-per-header :) |
Concept ACK nit: IMO better to split the the iwyu adds/removals into a 3rd commit on this PR, somewhat in the spirit of the "Pull Request Philosophy" |
The second commit is basically iwyu on |
To be clear as to what I'm referring to, note your commit messages both end with "Also ...". This alludes to the fact that you're doing a variety of things in each, which is a burden (in this case a minor one) on review. Feel free to disregard as a nit, but I think this is a good practice to keep in mind, that we may maintain discipline in how we structure our changes for the benefit of review. |
fa89408
to
fac3e2f
Compare
Thanks, I've split each commit to be iwyu targeted to one header/module. The overall force-push diff is zero. |
Concept ACK What about this one:
Probably should be moved to the implementation file, no? |
Can you post a patch that compiles? |
@RandyMcMillan That looks unrelated to the changes here. You'll have to use |
Seems like an easy win, no? diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7c74b6b9ff..fe4c3d0f67 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -79,6 +79,8 @@
#include <tuple>
#include <variant>
+#include <boost/signals2/signal.hpp>
+
struct KeyOriginInfo;
using interfaces::FoundBlock;
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 8a1a513062..24cedd5160 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -49,8 +49,6 @@
#include <utility>
#include <vector>
-#include <boost/signals2/signal.hpp>
-
class CKey;
class CKeyID;
class CPubKey; |
No. The boost include is still there (via |
Removing boost seems unrelated and can be done in a follow-up. You can help by reviewing the first step: #28240 |
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.
ACK fac3e2f
No. The boost include is still there (via src/wallet/scriptpubkeyman.h:#include <boost/signals2/signal.hpp>
Yeah, totally. Should have checked this before trusting the iwyu suggestion.
... and move them to where they are really needed. This was found by IWYU: txmempool.h should remove these lines: - #include <random.h> // lines 29-29 - class CBlockIndex; // lines 43-43 - class Chainstate; // lines 45-45 Also, move the stdlib section to the right place. Can be reviewed with: --color-moved=dimmed-zebra
This is needed for a future commit. Can be reviewed with: --color-moved=dimmed-zebra
face659
to
22223a7
Compare
This removes unused includes, primitives/block found manually, and the others by iwyu: blockfilter.h should remove these lines: - #include <serialize.h> // lines 16-16 - #include <undo.h> // lines 18-18
22223a7
to
fab5376
Compare
This removes unused includes, such as undo.h or txmempool.h from wallet.cpp. Also, add missing ones, according to IWYU.
fab5376
to
fa62868
Compare
rebased, should be trivial to re-ACK |
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.
ACK fa62868, I have reviewed the code and it looks OK.
…e time (#5693) ## Issue being fixed or feature implemented Some headers include other heavy headers, such as `logging.h`, `tinyformat.h`, `iostream`. These headers are heavy and increase compilation time on scale of whole project drastically because can be used in many other headers. ## What was done? Moved many heavy includes from headers to cpp files to optimize compilation time. In some places added forward declarations if it is reasonable. As side effect removed 2 circular dependencies: ``` "llmq/debug -> llmq/dkgsessionhandler -> llmq/debug" "llmq/debug -> llmq/dkgsessionhandler -> llmq/dkgsession -> llmq/debug" ``` ## How Has This Been Tested? Run build 2 times before refactoring and after refactoring: `make clean && sleep 10s; time make -j18` Before refactoring: ``` real 5m37,826s user 77m12,075s sys 6m20,547s real 5m32,626s user 76m51,143s sys 6m24,511s ``` After refactoring: ``` real 5m18,509s user 73m32,133s sys 6m21,590s real 5m14,466s user 73m20,942s sys 6m17,868s ``` ~5% of improvement for compilation time. That's not huge, but that's worth to get merged There're several more refactorings TODO but better to do them later by backports: - bitcoin#27636 - bitcoin#26286 - bitcoin#27238 - and maybe this one: bitcoin#28200 ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
This makes compilation of wallet.cpp use a few % less memory and time, locally.
Created in the context of #28109, but I don't think it is enough to actually fix this problem.