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

Possible ways to make compilation faster #8

Closed
klesun opened this issue Feb 15, 2020 · 3 comments
Closed

Possible ways to make compilation faster #8

klesun opened this issue Feb 15, 2020 · 3 comments

Comments

@klesun
Copy link
Owner

klesun commented Feb 15, 2020

Reminder: currently each module compilation takes 10-50 ms of CPU time.

  • Research typescript API/source code, there will probably be some tricks to transpile it faster, like disabling logging. If there will be an API to transpile already parsed Node objects separately, that would also improve performance about 2 times: since currently SourceFile is created twice per module - once to parse it for imports, and once to transpile modified version of it.

  • Run compilation in separate workers to get use of multiple CPU cores. If machine has 8 CPUs then ideally, compilation should become 8 times faster. b63443b

  • Keep compilation results for unchanged files in browser cache... probably should make it configurable. aba27dd

  • Minify typescriptServices.js file

  • Maybe passing all files to ts.transpile() at once would make compilation faster...

klesun added a commit to klesun-misc/ts-browser-beta that referenced this issue Feb 16, 2020
For some reason it did not become faster at all, possiblyI am doing something wrong
klesun added a commit to klesun-misc/ts-browser-beta that referenced this issue Feb 16, 2020
For some reason it did not become faster at all, possiblyI am doing something wrong
@klesun
Copy link
Owner Author

klesun commented Feb 16, 2020

b63443b

Moved transpilation process to workers. Compilation time is now 32% shorter on my machine: 4 CPU cores, 3 workers used.

https://klesun-productions.com/entry/midiana/ load time in ms

  • with workers: 2210, 2161, 2241 - Avg: 2204
  • without workers: 3224, 3263, 3247 - Avg: 3244.(6)

klesun added a commit that referenced this issue Feb 16, 2020
You do not normally change _all_ files constantly, so the performance boost should be pretty viable
@klesun
Copy link
Owner Author

klesun commented Feb 16, 2020

window.localStorage transpilation result caching - aba27dd

Same page now loads in 791, 854, 771 ms

@klesun
Copy link
Owner Author

klesun commented Mar 17, 2021

SWCSWCSWC

@klesun klesun closed this as completed Mar 17, 2021
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

No branches or pull requests

1 participant