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

API spec generation is slow #6282

Open
greenape opened this issue Aug 16, 2023 · 3 comments
Open

API spec generation is slow #6282

greenape opened this issue Aug 16, 2023 · 3 comments
Labels
FlowAPI Issues related to the FlowKit API performance

Comments

@greenape
Copy link
Member

~10s on my machine. This is only mildly an issue for actual use, because it isn't a frequently used endpoint. However it is an issue for the tests, and slows down the integration tests quite a bit.

From a poke around with py-spy, the overwhelming majority of the slowness is not in our code, but in the validation of the spec performed by prance. In principle, we could skip the validation altogether, because we actually only want prance in order to resolve the references. Alternatively, we would likely get a pretty big gain from some judicious caching. e.g. we could cache the result of parsing the dumped-to-string api spec, which skips multiple validations and resolves, and won't break if for some reason the spec changes without flowapi restarting. (We probably only want to cache one here).

@greenape greenape added FlowAPI Issues related to the FlowKit API performance labels Aug 16, 2023
@greenape
Copy link
Member Author

Hmm. Actually caching won't impact on our flakey tests, because the api spec is only got once per fixture initialisation, maybe would be better off using the resolver directly?

@Thingus
Copy link
Contributor

Thingus commented Aug 18, 2023

Do you have a line reference from pyspy?

@greenape
Copy link
Member Author

30902-2023-08-16T12:59:56+01:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FlowAPI Issues related to the FlowKit API performance
Projects
None yet
Development

No branches or pull requests

2 participants