Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow compilation time for a hello world program (7/8 seconds)

See original GitHub issue

TypeScript Version: 3.9.5

Issue: I created a simple hello world program, and it took 3s to compile with --skipLibCheck, and 7/8s without. is there a way to improve compile time? output of my terminal:

➜  cat hello.ts
console.log('hello world');
➜  time tsc --skipLibCheck --extendedDiagnostics hello.ts
Files:                         77
Lines:                      42747
Nodes:                     186757
Identifiers:                67158
Symbols:                    44908
Types:                         80
Instantiations:                 0
Memory used:               69869K
Assignability cache size:       0
Identity cache size:            0
Subtype cache size:             0
Strict subtype cache size:      0
I/O Read time:              0.01s
Parse time:                 0.85s
ResolveTypeReference time:  0.01s
ResolveModule time:         0.04s
Program time:               0.96s
Bind time:                  0.56s
Check time:                 0.01s
transformTime time:         0.01s
commentTime time:           0.00s
I/O Write time:             0.00s
printTime time:             0.02s
Emit time:                  0.02s
Total time:                 1.56s
tsc --skipLibCheck --extendedDiagnostics hello.ts  3.45s user 0.09s system 187% cpu 1.889 total

Additional info: OS: Windows 10 Intel Core i7-8565U CPU @ 1.80GHZ / 16GB RAM / SSD SATA Terminal: WSL 2 (ubuntu) Node version: v14.4.0

Expected behavior: 0.1s compilation.

Actual behavior: 3/4s second compilation, without skipLibCheck it goes to 7/8s.


  • when I compile this program with deno (deno run hello.ts), it takes 0.5s, which is good! is there a way to have something close to deno with tsc? maybe by using a v8 snapshot as they did?

Related Issues:

Search Terms:

  • slow compilation
  • improve startup time
  • v8 snapshot

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

DanielRosenwassercommented, Jun 30, 2020

Here’s the new section: Controlling @types Inclusion.

DanielRosenwassercommented, Jun 30, 2020

You can set the "types" field to [] which should stop TypeScript from automatically sucking in all @types/ folders unless you import them. I’ll update the Performance page to mention this too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does C++ compilation take so long?
Contrary to popular belief, compiling C++ is not actually all that slow. The STL is slow and most build tools used to compile...
Read more >
C programs taking a lot of time to run. Simple "hello world" ...
Running again brings it down to 2-3 seconds, but still it's a lot. Programs with bit of calculation take more than 10 seconds....
Read more >
It is fast or it is wrong
Clojure 1.10 on JVM: REPL boot time: 1.5 sec Compile time: 6.5 sec ... same code, you can either spend ~8 seconds, 24...
Read more >
Why is my Rust build so slow?
If you haven't been writing Rust for a long time, you've probably heard "Rust compile times are long" and so it might be...
Read more >
Unity assembly definition files slower, not faster
With a super simple project with only one script + the CompileTime script, the compile time is 3.5 seconds. Is that the best...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found