Add librt functionality for lazy deserialization by ilevkivskyi · Pull Request #21158 · python/mypy

@ilevkivskyi

Together with #21158, this gets us
95% there for lazy desrialization. Implementation is generally
straightforward. At some point I wanted to unify the new global state
with (parts of) the checker state, and potentially get rid of a bunch of
`named_type` callbacks we pass around, but decided to do this later in a
separate PR, since this is not strictly necessary for parallel checking.

Although this PR itself only makes fixup phase (which is the smaller
part of deserialization) lazy, it already shows small performance
improvements:
* ~net zero on self-check
* few percent faster cold `torch` with 4 workers
* ~15% faster warm `torch`