-
Notifications
You must be signed in to change notification settings - Fork 2k
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
streamable: Cache convert functions from dataclass_from_dict
#10561
streamable: Cache convert functions from dataclass_from_dict
#10561
Conversation
This pull request fixes 1 alert when merging 51f97c79c9a6276b8e91287dd791118b046e3674 into 4bd5c53 - view on LGTM.com fixed alerts:
|
51f97c7
to
d304440
Compare
This pull request fixes 1 alert when merging d304440b3c352134df7d8f903583e1917e176ad9 into 0e29dbc - view on LGTM.com fixed alerts:
|
d304440
to
b55b64a
Compare
This pull request fixes 1 alert when merging b55b64ae97a243a23c527397a15acdf7661cc33e into 0e29dbc - view on LGTM.com fixed alerts:
|
This PR has been flagged as stale due to no activity for over 60 days. It will not be automatically closed, but it has been given a stale-pr label and should be manually reviewed by the relevant parties. |
b55b64a
to
6be309b
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
6be309b
to
01d8712
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
@arvidn is making changes to the same code, so it's probably good to coordinate |
@mariano54 Do you mean #11537? If so, thats |
Yes that is the one I was referring to. |
Co-authored-by: Kyle Altendorf <sda@fstab.net>
This fixes default value assignments after Chia-Network#10561 but also leads to less perfomance due to `__post_init__` being called which at least gets mitigated by Chia-Network#11730.
…11732) * streamable: Use constructor in `dataclass_from_dict` This fixes default value assignments after #10561 but also leads to less perfomance due to `__post_init__` being called which at least gets mitigated by #11730. * tests: Test default values with `from_json_dict` * Convert to `str`, then compare.
Applies the pattern from #10419 to
dataclass_from_dict
i.e. it caches the conversion functions on startup which leads to nice improvements of thefrom_json
benchmark (CallingClass.from_json_dict
). Not so much forfull_block
, i guess because the subgroup checks of the BLS deserialisation still dominate.It also adds some more tests where
dataclass_from_dict
gets used with non-streamable dataclasses because there is a special handling of them now in there where the cache gets created on the fly (we can't do it on startup for non-streamable dataclasses because of the missing decorator call).https://github.com/Chia-Network/chia-blockchain/blob/5b1b4ddd9d3b72f66ef57e42528c1f9674b869d3/chia/util/streamable.py#L124-L135
Based on #10539