FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Cache common instances by ilevkivskyi · Pull Request #19621 · python/mypy · GitHub

Repository navigation

Cache common instances - #19621

Merged
ilevkivskyi merged 3 commits into
python:masterfrom
ilevkivskyi:tst-prf-1
Aug 9, 2025
Merged

ilevkivskyi merged 3 commits into
python:masterfrom
ilevkivskyi:tst-prf-1

Conversation

Copy link
Copy Markdown
Member

These few types account for a significant proportion of all types created:

  • str is just everywhere
  • object and function are used as fallbacks in many places
  • int and bool are coming from various literals

This gives around 1.5% performance improvement on my desktop. This is a bit ugly, but also looks like an easy win. Note that during semantic analysis I am caching types more conservatively, just in case some plugins modify them in place (named_type() is a part of semantic analyzer plugin interface).

github-actions Bot commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

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

ilevkivskyi merged commit cc5f1e1 into python:master Aug 9, 2025
ilevkivskyi deleted the tst-prf-1 branch August 9, 2025 08:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL