Skip to content

Add proper lazy deserialization#21198

Merged
ilevkivskyi merged 1 commit intopython:masterfrom
ilevkivskyi:lazy
Apr 10, 2026
Merged

Add proper lazy deserialization#21198
ilevkivskyi merged 1 commit intopython:masterfrom
ilevkivskyi:lazy

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

On Linux with Python 3.12 this gives (compared to 1.20.0):

  • almost 2x less memory overhead per parallel worker
  • 3-4% faster cold parallel runs
  • (most notably) ~2x faster mypy -c 'import torch' with warm cache, on my desktop warm torch now takes 250-300ms

cc @JukkaL

@github-actions
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

This is a big win! With this I was able to use 8 workers when type checking a big internal repo -- previously the workers would have used too much RAM for this to be feasible.

@ilevkivskyi ilevkivskyi merged commit be51e9c into python:master Apr 10, 2026
24 checks passed
@ilevkivskyi ilevkivskyi deleted the lazy branch April 10, 2026 15:31
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