Comparison

Tern vs TypeScript

TypeScript gives you types; Node gives you a runtime to ship and feed. Tern checks types the same way before anything runs, then compiles to one native binary that uses every core.

curl -fsSL https://ternlang.dev/install.sh | sh
tern new myapp && cd myapp

Same spec, same agent

Agent-built link shortenerTernTypeScript (Node)
Lines of code excluding tests273502
Redirects per second146k47k
CPU per redirect23 µs21 µs one thread
Deployed size408 KB25.8 MB
Memory at idle4.4 MB89.6 MB

Both apps pass the same 32 black-box acceptance checks. Node used slightly less CPU per request on its one thread; Tern spreads requests over every core. Details on the agents page.

What’s different

Pick TypeScript when

Already on TypeScript and want faster builds? ternTS, written in Tern, transpiles exactly like tsc, many times faster.

Questions

Is Tern faster than Node.js?

For the server in our test, yes: 146k vs 47k requests per second, because Tern uses every core. Per request on one thread, Node used slightly less CPU (21 vs 23 microseconds).

Can Tern run in the browser?

As WebAssembly: tern build --lib --target wasm writes a module, a JavaScript loader and TypeScript types.

More about Tern

Tern (ternlang) is an early release: the language will change, and so will these numbers. Benchmarks run on an Apple M4 Pro; the full tables, losses included, are on the home page.