Look for performance improvements related to large unions #4781
Labels
addressed in next version
Issue is fixed and will appear in next published version
enhancement request
New feature or request
The pydantic source base includes a type alias called
CoreSchema
that is defined as a union with 40+ types. This type alias is used in many parts of the code, including TypeVar bounds. When I run pyright on the pydantic code base, it takes more than 20s to complete. If I reduce the number of items in theCoreSchema
union from 40 to 5, the total type checking time drops to less than 1s. We should determine if there are ways to avoid n^2 (or worse) behaviors for common operations on unions.The text was updated successfully, but these errors were encountered: