Skip to content

Design Meeting Notes, 5/10/2019 #31350

Closed
Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Perf edition!

Fix relations of instantiations of the same signature

#31029

  • Problem is that when we relate signatures to each other, we erase type parameters to anys.
  • 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 the addObserver 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:

Caching control flow results across invocations

#31003

  • 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

#8856
#31166

  • 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.
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions