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

No shared code between compiler and runtime snapshots #6812

Closed
ry opened this issue Jul 19, 2020 · 2 comments · Fixed by #6809
Closed

No shared code between compiler and runtime snapshots #6812

ry opened this issue Jul 19, 2020 · 2 comments · Fixed by #6809

Comments

@ry
Copy link
Member

ry commented Jul 19, 2020

Currently the runtime and compiler snapshot share a lot of code. Currently every function available in the runtime is available in the compiler snapshot: fetch(), setTimeout() etc. However the compiler snapshot has no need for much of this code.

The compiler and runtime have ultimately very different purposes. The runtime is exposed to users, the compiler is completely internal.

We want the compiler snapshot to be as small as possible.

Ref #6809

@kitsonk
Copy link
Contributor

kitsonk commented Jul 19, 2020

As I mentioned in other threads, I have started work on a stand alone compiler crate that would only have the code it needs to do TypeScript compiling, which would be a single file .js file, plus the ability to create snapshots. It is based on deno_typescript but should be able to provide all that is needed for the CLI, but also be independent, and so in theory reusable. It will be abstracted from the cache.

@kitsonk
Copy link
Contributor

kitsonk commented Jul 19, 2020

(It also incorporates the re-worked bundling that was in my PR for deno_typescript that moves the bundling out of TypeScript and emits valid source maps)

@ry ry closed this as completed in #6809 Jul 22, 2020
ry added a commit that referenced this issue Jul 22, 2020
This PR is intentionally ugly. It duplicates all of the code in cli/js2/ into
cli/tsc/  ... because it's very important that we all understand that this code
is unnecessarily duplicated in our binary. I hope this ugliness provides the
motivation to clean it up.

The typescript git submodule is removed, because it's a very large repo and
contains all sorts of stuff we don't need. Instead the necessary files are
copied directly into the deno repo. Hence +200k lines.

COMPILER_SNAPSHOT.bin size
```
master         3448139
this branch    3320972
```

Fixes #6812
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 a pull request may close this issue.

2 participants