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

fix potential performance issue caused by language server settings being re-loaded on every keystroke when doing inlay hints #922

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

DetachHead
Copy link
Owner

No description provided.

This comment has been minimized.

…ing re-loaded on every keystroke when doing inlay hints
@DetachHead DetachHead force-pushed the dont-reload-settings-on-type branch from 1bac9fc to 8279ae3 Compare December 3, 2024 08:43
@DetachHead DetachHead enabled auto-merge (rebase) December 3, 2024 08:55
@DetachHead DetachHead merged commit 23dfa0a into main Dec 3, 2024
20 checks passed
@DetachHead DetachHead deleted the dont-reload-settings-on-type branch December 3, 2024 09:09
Copy link
Contributor

github-actions bot commented Dec 3, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-     Type of "factor" is "(f: Unknown, ..., deep: bool = False) -> (Unknown | Add | Order | Mul | Expr)" (reportUnknownVariableType)
+     Type of "factor" is "(f: Unknown, ..., deep: bool = False) -> (Unknown | Add | Order | Mul)" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool], Any]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | bool], Any]", is partially unknown (reportUnknownParameterType)
-     Type of "constraints" is "list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool]" (reportUnknownVariableType)
+     Type of "constraints" is "list[_NotImplementedType | Unknown | Any | bool]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool], Any]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | bool], Any]", is partially unknown (reportUnknownVariableType)
-     Type of "system" is "list[_NotImplementedType | StrictLessThan | Unknown | Equality | Relational | Unequality | StrictGreaterThan]" (reportUnknownVariableType)
+     Type of "system" is "list[_NotImplementedType | Unknown]" (reportUnknownVariableType)
-     Type of "system" is "list[_NotImplementedType | StrictLessThan | Unknown | Equality | Relational | Unequality | StrictGreaterThan]" (reportUnknownVariableType)
+     Type of "system" is "list[_NotImplementedType | Unknown]" (reportUnknownVariableType)
-     Argument type is "Generator[_NotImplementedType | StrictLessThan | Unknown | Equality | Relational | Unequality, None, None]" (reportUnknownArgumentType)
+     Argument type is "Generator[_NotImplementedType | Unknown, None, None]" (reportUnknownArgumentType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solveset.py:1267:5 - warning: Type of "f1" is partially unknown
-     Type of "f1" is "Expr | Unknown" (reportUnknownVariableType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solveset.py:1268:5 - warning: Type of "f2" is partially unknown
-     Type of "f2" is "Expr | Unknown" (reportUnknownVariableType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Unknown)" (reportUnknownMemberType)
+     Type of "rewrite" is "(..., deep: bool = True) -> (Expr | Any)" (reportUnknownMemberType)
-     Type of "eq" is "_NotImplementedType | GreaterThan | Unknown | Equality | Relational | Unequality" (reportUnknownVariableType)
+     Type of "eq" is "_NotImplementedType | Unknown" (reportUnknownVariableType)
-     Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | Zero | One | Expr | Float | ComplexInfinity | Rational | NaN | NegativeOne | Integer | Half | Infinity | NegativeInfinity | _NotImplementedType | Self@Expr | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Lambda | Number | int | None)" (reportUnknownVariableType)
+     Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | Zero | One | Self@Expr | tuple[Unknown, ...] | Sum | Order | NaN | Piecewise | Basic | Equality | Add | ComplexInfinity | Expr | Float | Half | Infinity | Integer | Lambda | NegativeInfinity | NegativeOne | Number | Rational | int | None)" (reportUnknownVariableType)
-     Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
+     Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
-     Type of "H" is "(expr: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (int | Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
+     Type of "H" is "(expr: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (int | Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
-     Type of "variance" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (VarianceMatrix | Variance | Unknown | CentralMoment)" (reportUnknownVariableType)
+     Type of "variance" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (VarianceMatrix | Variance | Unknown | Any | CentralMoment)" (reportUnknownVariableType)
-     Type of "skewness" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Unknown | Expr)" (reportUnknownVariableType)
+     Type of "skewness" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Unknown | Any | Expr)" (reportUnknownVariableType)
-     Type of "kurtosis" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Unknown | Expr)" (reportUnknownVariableType)
+     Type of "kurtosis" is "(X: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Unknown | Any | Expr)" (reportUnknownVariableType)
-     Type of "covariance" is "(X: Unknown, Y: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (CrossCovarianceMatrix | Covariance | Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
+     Type of "covariance" is "(X: Unknown, Y: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (CrossCovarianceMatrix | Covariance | Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
-     Type of "entropy" is "(expr: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (int | Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
+     Type of "entropy" is "(expr: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (int | Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
-     Type of "factorial_moment" is "(X: Unknown, n: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
+     Type of "factorial_moment" is "(X: Unknown, n: Unknown, condition: Unknown | None = None, **kwargs: Unknown) -> (Expr | Basic | Expectation | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Zero | NaN | Piecewise | Equality | Integral | ExpectationMatrix | Literal[0] | None)" (reportUnknownVariableType)
-     Type of "moment" is "(X: Unknown, n: Unknown, c: int = 0, condition: Unknown | None = None, *, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Moment)" (reportUnknownVariableType)
+     Type of "moment" is "(X: Unknown, n: Unknown, c: int = 0, condition: Unknown | None = None, *, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | Moment)" (reportUnknownVariableType)

... (truncated 2392 lines) ...

vision (https://github.com/pytorch/vision): 1.58x slower (41.1s -> 64.8s in a single noisy sample)

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