Skip to content

Use cache for DictExpr as well #19536

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

Merged
merged 1 commit into from
Jul 30, 2025
Merged

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Jul 30, 2025

Fixes #14271
Fixes #14636

TBH examples in those issues are already sufficiently fast (probably because of combined effect of fast dict literals, and the fact that there are some lists and/or function calls in that examples, so some caching already kicks in). But this PR will probably make them even faster.

This has ~0 effect on self-check.

@ilevkivskyi ilevkivskyi requested a review from sterliakov July 30, 2025 01:05
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@sterliakov sterliakov left a comment

Choose a reason for hiding this comment

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

Makes sense! Nice that the referenced tickets are already fast enough, maybe it's time to review existing tickets tagged "performance" and see if we have already fixed some pathological cases.

@ilevkivskyi
Copy link
Member Author

maybe it's time to review existing tickets tagged "performance" and see if we have already fixed some pathological cases.

I already closed couple others, but didn't do any kind of thorough tracker review.

@ilevkivskyi ilevkivskyi merged commit 0f78f9c into python:master Jul 30, 2025
20 checks passed
@ilevkivskyi ilevkivskyi deleted the cache-dict-expr branch July 30, 2025 09:12
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.

Mypy errors out for deeply nested dictionaries Wildly inconsistent performance for seemingly trivial changes to source code
2 participants