Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential method to shorten evaluation time for certain packages #7477

Closed
wants to merge 1 commit into from

Conversation

rchiodo
Copy link
Collaborator

@rchiodo rchiodo commented Mar 13, 2024

See this comment here:
#7159 (comment)

After some investigation I found that sympy is just evaluating a lot more types. This change allows a limit be set for expanding types. Internally in Pylance I was thinking we'd have a setting like so:

"python.analysis.minimizedPackages": ["sympy"]

This would be applied to the type argument on the filter to see what module the type comes from. If a package is in this list, the user will still get some information, but the package will analyze much faster.

The alternative would be to provide type stubs for these packages, but that can take a long time. This is more like a shortcut for when we know certain packages are slow to analyze.

@rchiodo rchiodo requested a review from erictraut March 13, 2024 16:53
@rchiodo rchiodo self-assigned this Mar 13, 2024
@rchiodo
Copy link
Collaborator Author

rchiodo commented Mar 13, 2024

After using this setting for sympy, sympy analysis times are back to what they were before 6753a5d

Copy link
Contributor

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

Copy link
Collaborator

@erictraut erictraut left a comment

Choose a reason for hiding this comment

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

Please DO NOT commit this change. This will produce inconsistent and non-deterministic type evaluation results. I understand the desire to speed up sympy analysis, but this is NOT the right approach.

@rchiodo rchiodo closed this Mar 13, 2024
@rchiodo rchiodo deleted the rchiodo/filter_packages branch March 13, 2024 17:08
@rchiodo
Copy link
Collaborator Author

rchiodo commented Mar 13, 2024

Okay I'll look into generating stubs instead.

@erictraut
Copy link
Collaborator

Stubs are one answer, but there might be other solutions. It sounds like you have done some analysis on the problem. If you're able to write up the notes about what you've found and include them in this issue, I might be able to suggest other potential solutions. I haven't had time to do an in-depth analysis of the problem yet (and probably won't have time in the near future), but if you've already done the analysis, we might be able to tag-team.

@rchiodo
Copy link
Collaborator Author

rchiodo commented Mar 13, 2024

Thanks. I did add some comments but I'll try to add some more detail.

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