Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up State.finish_passes (#18302)
Don't use a set to deduplicate mypy `Type` objects, since taking the hash of a type, and possibly comparing for equality (which is needed to add a type to a set) is more expensive than processing duplicates in TypeIndirectionVisitor. Many of the most expensive types to process are complex types such as callables, which often don't have many duplicates and have complex `__hash__` methods. This seems to speed up type checking torch slightly, by about 0.5% (average of 100 runs).
- Loading branch information