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

[FR]: type-check dependent projects in parallel #374

Closed
alexeagle opened this issue May 22, 2023 · 5 comments · Fixed by #679
Closed

[FR]: type-check dependent projects in parallel #374

alexeagle opened this issue May 22, 2023 · 5 comments · Fixed by #679
Assignees
Labels
blocked Blocked by another issue enhancement New feature or request

Comments

@alexeagle
Copy link
Member

alexeagle commented May 22, 2023

IMPORTANT: This depends on an unimplemented feature request in TypeScript: --isolatedDeclarations microsoft/TypeScript#47947

What is the current behavior?

Currently, type-checking a tree of targets like app <-- counter <-- textutils/splitter requires that they are run in serial, because the results of type-checking a library are needed by all transitive dependents as inputs to their type-check action.

Quoting from the --isolatedDeclarations proposal:

To compile, we need to first compile textutils/splitter, wait for that to complete, e.g. 5s, then compile counter, wait e.g. 3s, then compile app (6s). Total compilation wall time is |app| + |counter| + |textutils/splitter|, in our example 5s + 3s + 6s = 16 seconds.

Describe the feature

Again, quoting from the --isolatedDeclarations proposal:

Now assume we could produce .d.ts files without requiring transitive inputs. That'd mean we could, in parallel, produce the .d.ts files for textutils/splitter, counter (and app, though we don't need that). After that, we could, in parallel, type check and compile textutils/splitter, counter, and app. Assuming sufficient available parallelism (which seems reasonable, given how common multicore CPUs are), total compilation wall time is the maximum time to extract .d.ts files, plus the time for the slowest compile. Assuming .d.ts extraction is purely syntactical, i.e. does not need type checking nor symbol resolution, it shouldn't add more overhead than a few hundred ms. Under these assumptions, the wall time to wait for the project to compile would be 500 ms + 6s = 6.5 seconds, i.e. more than a x2 speedup.

When the --isolatedDeclarations feature is available in some version of TypeScript, then rules_ts should support it with an action graph like the one implied there.

@alexeagle alexeagle added the enhancement New feature or request label May 22, 2023
@github-actions github-actions bot added the untriaged Requires traige label May 22, 2023
@alexeagle alexeagle added blocked Blocked by another issue and removed untriaged Requires traige labels Aug 7, 2023
@alexeagle
Copy link
Member Author

Note, this is unblocked and work likely to begin in the next month or so.

@binoche9
Copy link

TypeScript 5.5 is out with --isolatedDeclarations support!

@alexeagle
Copy link
Member Author

alexeagle commented Jul 1, 2024

Work on this has begun, thanks to folks from several companies for helping to vet designs! (and of course @mprobst for getting the ball rolling!)
Note that TypeScript 5.5 only gave us the beginning of the story: enforcing that source files have enough type annotations to be able to emitDeclarations from them without type-checking.

jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Aug 29, 2024
jbedard added a commit to jbedard/rules_ts that referenced this issue Sep 5, 2024
@gzm0
Copy link
Contributor

gzm0 commented Sep 10, 2024

TS 5.6 with --noCheck is out \o/ (sorry for the spam, this is exciting 🤩)

@jbedard
Copy link
Member

jbedard commented Sep 10, 2024

See #679 for the first big step 😄

@jbedard jbedard self-assigned this Sep 24, 2024
@github-project-automation github-project-automation bot moved this to ✅ Done in Open Source Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by another issue enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants