Skip to content

Bashamega/tsgo-vs-tsc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tsgo-vs-tsc ⚡

Benchmark the performance of TypeScript (tsc) vs TypeScript-Go (tsgo) compilers. Quickly see which compiler is faster on your project.


📦 Installation

Global install (recommended)

Using yarn:

yarn global add tsgo-vs-tsc

Or with npm:

npm install -g tsgo-vs-tsc

Now you can run the CLI from anywhere:

tsgo-vs-tsc

Local install (alternative)

If you prefer project-local usage:

yarn add -D tsgo-vs-tsc
# or
npm install --save-dev tsgo-vs-tsc

Then run via npx:

npx tsgo-vs-tsc

🚀 Usage

Basic

Benchmark compilers on your default tsconfig.json:

tsgo-vs-tsc

Custom config

Benchmark against a specific config file:

tsgo-vs-tsc ./path/to/tsconfig.build.json

Local binaries

By default, the script uses the compilers bundled with this package. To force it to run using your locally installed versions via npx, add the --local (or -l) flag:

tsgo-vs-tsc -l

📊 Example Output

🔬 Benchmarking TypeScript compilers on: ./tsconfig.json

📊 Results:
┌─────────┬──────────┬───────────┬───────────────┐
│ (index) │ Compiler │ Time (ms) │     Error     │
├─────────┼──────────┼───────────┼───────────────┤
│    0    │   tsc    │   520.31  │    None!      │
│    1    │  tsgo    │   133.84  │    None!      │
└─────────┴──────────┴───────────┴───────────────┘
🏆 Fastest: tsgo (133.84 ms)

⚙️ Options

Flag Description
-l, --local Use npx tsc and npx tsgo instead of package-bundled binaries.
<config-path> Path to a custom tsconfig.json. Defaults to ./tsconfig.json.

📌 Notes

  • This tool measures compile execution time only.
  • It does not check correctness of output JavaScript.
  • If either compiler fails, the error is captured and displayed in the results table.

🛠 Development

Clone the repo and run locally:

yarn install
yarn build
npx tsgo-vs-tsc ./tsconfig.json

About

Benchmark TypeScript-Go against TypeScript (tsgo vs tsc).

Resources

License

Stars

Watchers

Forks