Skip to content

Optimize mypy/solve.py with min instead of sort #18688

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

Conversation

Skylion007
Copy link
Contributor

The first value of a stable sort always equivalent to a linear min search (and uses less memory).

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

django-stubs (https://github.com/typeddjango/django-stubs): 2.05x faster (47.9s -> 23.3s in a single noisy sample)

@hauntsaninja hauntsaninja merged commit d8bf6e2 into python:master Feb 20, 2025
18 checks passed
@hauntsaninja
Copy link
Collaborator

Thanks!

x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
The first value of a stable sort always equivalent to a linear min
search (and uses less memory).
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