Open hauntsaninja opened 2 days ago
If this is accurate, maybe the fscache exception handling is really slowing us down in the mypyc build.
mypyc:
interpreted:
mypy -v
produces details about processed files, and this seems important:
LOG: Processing SCC of size 945 (torch.onnx._globals torch._inductor.exc torch._inductor.runtime.hi
nts torch.utils._traceback torch.utils._sympy.functions ... <long output snipped>
Mypy detects an import cycle with 945 modules.
Overall 1380 files were parsed, so 68% of processed files are in this one SCC. I've seen this pattern in other third-party packages as well -- the majority of the implementation is a single SCC.
A potential way to make the SCC smaller would be to process imports lazily in third-party modules (where this is possible, since errors aren't reported). It may be tricky to implement though, but I'll think about it more.
Yeah, lazy import resolution could be a massive perf win
We use a lot of torch at work, performance is probably the biggest reason folks at work switch to a different type checker.