Closed
Description
Perf edition!
Fix relations of instantiations of the same signature
- Problem is that when we relate signatures to each other, we erase type parameters to
any
s. - We have a fix for that, but nowadays whenever we have a fix we also have a break.
- It blows up types for styled-components/v3 blows up with an out-of-memory (OOM) error.
- And it breaks Ember's
Observer
type (which is actually invarian) and theaddObserver
method whose methods take a key and a value for the current type. - The more recent
styled-components
increases in type-checking time.- About 2 seconds.
Now we're talking about
Slow completions
- Completions have slowed down nowadays as well, partially because we check against the
this
type to decide whether we should even show methods in the first place. - Wesley: The problem is that we do a fully structural check, but we fundamentally need to make that cheap somehow.
- One idea is that we need to be able to keep the constraint from the false branch of conditionals to short-circuit operations (by not eagerly evaluating conditionals)
- Introducing negated types would be problematic for reasoning about, display purposes.
- Worth trying at least.
- Could also try to avoid instantiations of conditionals using
infer
types. - We also don't cache the results of what conditional inference does.
- One other thing is we need to be able to help inform people whether their DefinitelyTyped changes are going to cause regressions so we can judge whether more accurate types are "worth it".
Action items:
- Fixes for Ember types (@ahejlsberg)
- Remove
this
parameter filtering in completions. (@weswigham) - Defer merging Fix relations for instantiations of same generic signature #31029 (@ahejlsberg)
- Investigate negated type fixes (@weswigham)
Caching control flow results across invocations
- Minor slowdowns and increased memory usage by adding the change, but fixes crazy-long cases with assignments on the LHS.
- Why doesn't the test case cause an issue?
- Element access assignments can't be cached, these can.
- Resolution: merge for 3.5.
Array spread emit fixes
- The way that we emit array spreads in ES5 is incorrect because we use
concat
and that omits missing elements.- In
--downlevelIteration
, this works right, but not otherwise.
- In
- We had an initial version that was slower, but still didn't affect the compiler much.
- A community member suggested something that's faster, is almost as fast as the original.
- Resolution: approved, but for 3.6