Skip to content

Simplify Hooks#2279

Merged
lafrech merged 2 commits intomarshmallow-code:devfrom
deckar01:simplify-hooks
Aug 20, 2024
Merged

Simplify Hooks#2279
lafrech merged 2 commits intomarshmallow-code:devfrom
deckar01:simplify-hooks

Conversation

@deckar01
Copy link
Copy Markdown
Member

@deckar01 deckar01 commented Jun 6, 2024

  • Replace slow tuple-keyed dicts with string-keyed dicts
  • Load the hook config into cls._hook at setup rather than searching fn.__marshmallow_hook__ at run-time
  • Skip mismatched many hooks while iterating rather than indexing and filtering them
  • pypy (3.10): ~30% speedup
  • cpython (3.10): <1% difference
  • cpython (3.11, 3.12): ~3.5% speedup

@deckar01
Copy link
Copy Markdown
Member Author

deckar01 commented Jun 6, 2024

Follow up to #2277 (comment).

@lafrech
Copy link
Copy Markdown
Member

lafrech commented Jun 9, 2024 via email

@lafrech lafrech mentioned this pull request Aug 20, 2024
@lafrech lafrech merged commit 7609530 into marshmallow-code:dev Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants