Skip to content

Cache compiled JSON schema validators - #965

Merged
radoering merged 1 commit into
python-poetry:mainfrom
dimbleby:cache-schema
Sep 4, 2026
Merged

radoering merged 1 commit into
python-poetry:mainfrom
dimbleby:cache-schema

Conversation

@dimbleby

Copy link
Copy Markdown
Contributor

A bit artificial - I do not expect this to make any real difference to users, a typical execution of poetry will not run this path often.

But: running the complete set of poetry unit test - where we load the same schema many many times - this saves something like 20% of wall time. Which is enough of an improvement to the developer experience that it seems worth having.

Schema files are static, but each validation currently recompiles
validators. Cache them by schema name to avoid repeated compilation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dimbleby

dimbleby commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor Author

less than 20% but more than 10% comparing the previous CI run with the one for this pull request

before: 85s, after 76s

there is quite a lot of noise eg because of randomisation of test order, I was seeing more locally, it is what it is

@radoering
radoering merged commit df40e89 into python-poetry:main Sep 4, 2026
19 checks passed
@dimbleby
dimbleby deleted the cache-schema branch September 4, 2026 18:07
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.

2 participants