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

fix: add memoization to pkg_version_info to reduce cpu overhead #4794

Merged
merged 1 commit into from
Jun 12, 2024
Merged

fix: add memoization to pkg_version_info to reduce cpu overhead #4794

merged 1 commit into from
Jun 12, 2024

Conversation

adrianlyjak
Copy link
Contributor

@adrianlyjak adrianlyjak commented Jun 12, 2024

Addresses resource overhead from repeated calls to pkg_version_info. This function is called with only a handful of static strings, so it seems reasonable to just memoize the value indefinitely. The function is called in hot regions of the code, for example request json parsing and formatting when checking pydantic versions.

Fixes #4784

No tests written, but seems like this should be covered by existing tests.

@adrianlyjak adrianlyjak marked this pull request as ready for review June 12, 2024 02:14
@adrianlyjak adrianlyjak requested a review from a team as a code owner June 12, 2024 02:14
@adrianlyjak adrianlyjak requested review from xianml and removed request for a team June 12, 2024 02:14
@frostming frostming merged commit 7c6eb0c into bentoml:main Jun 12, 2024
41 of 42 checks passed
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.

bug: Excessive time spent parsing pydantic version
2 participants