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
Optimize update_pool_config()
#17969
Open
arvidn
wants to merge
3
commits into
main
Choose a base branch
from
optimize-pool-config
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+98
−70
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
arvidn
added
the
Changed
Required label for PR that categorizes merge commit message as "Changed" for changelog
label
May 4, 2024
arvidn
force-pushed
the
optimize-pool-config
branch
2 times, most recently
from
May 4, 2024 16:24
801e6d5
to
ac7e563
Compare
arvidn
commented
May 4, 2024
chia/pools/pool_wallet.py
Outdated
@@ -239,7 +239,7 @@ async def get_tip(self) -> Tuple[uint32, CoinSpend]: | |||
async def update_pool_config(self) -> None: | |||
start_time = time.monotonic() | |||
current_state: PoolWalletInfo = await self.get_current_state() | |||
with lock_and_load_config(self.wallet_state_manager.root_path, "config.yaml") as config: |
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.
without the full qualification here, monkeypatch doesn't take effect
arvidn
force-pushed
the
optimize-pool-config
branch
from
May 4, 2024 20:36
ac7e563
to
25bdc49
Compare
|
altendky
requested changes
May 6, 2024
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.
in process reviewing and discussing with arvid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Changed
Required label for PR that categorizes merge commit message as "Changed" for changelog
coverage-diff
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.
Please review this one commit at a time.
The last commit is updating the test (which relies on monkeypatch and a specific implementation). The functions that are monkeypatched are changed which has some other ripple effects.
Purpose:
currently,
update_pool_config()
loads the configs, makes changes to it, then callsupdate_config()
.update_config()
, again, loads the config file under the file lock, updates it, and saves it.The patched version avoid the redundant re-loading of the config by loading it under the lock file directly. It also avoids some unnecessary parsing of the fields.
In my test wallet this brings the loading time from 70 seconds to 45 seconds.
It's still really slow, primarily because of the YAML parsing library we use.
Current Behavior:
update pool config takes 70 seconds
New Behavior:
update pool config takes 45 seconds
profile before:
profile after:
log of timings before
log of timings after