Skip to content
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

make re-usable TypeAdapter instances for client schemas #16089

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zzstoatzz
Copy link
Collaborator

@zzstoatzz zzstoatzz commented Nov 22, 2024

moves creation of type adapters out of client method impls

related to #15047

this actually increases import time, which makes sense. there's a question of whether this is really better, since you could argue you only have to construct the type adapter instance if you use that specific client method.

will look into if defer_build can be used here (doesn't seem to apply to config as accepted by TypeAdapter)

Copy link

codspeed-hq bot commented Nov 22, 2024

CodSpeed Performance Report

Merging #16089 will not alter performance

Comparing make-less-adapters (c2420ee) with main (340e296)

Summary

✅ 3 untouched benchmarks

@zzstoatzz
Copy link
Collaborator Author

zzstoatzz commented Nov 22, 2024

Merging #16089 will degrade performances by 11.69%

this does makes sense, since we're making all of the adapters at import time, but I think this is worth it

@zzstoatzz zzstoatzz requested a review from aaazzam November 22, 2024 19:57
@zzstoatzz zzstoatzz marked this pull request as ready for review November 22, 2024 19:57
@zzstoatzz zzstoatzz changed the title stop remaking core schemas make re-usable TypeAdapter instances for client schemas Nov 22, 2024
@zzstoatzz zzstoatzz marked this pull request as draft November 22, 2024 19:58
@aaazzam
Copy link
Collaborator

aaazzam commented Nov 24, 2024

@zzstoatzz zzstoatzz self-assigned this Nov 25, 2024
@zzstoatzz zzstoatzz added the development Tech debt, refactors, CI, tests, and other related work. label Dec 9, 2024
@zzstoatzz zzstoatzz marked this pull request as ready for review December 9, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Tech debt, refactors, CI, tests, and other related work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants