Comparison
Tern vs Go
Both compile to one binary and keep the language small. Tern reads like Python, has no nil and no data races, and is faster on our benchmarks. Go is mature and has a huge ecosystem.
curl -fsSL https://ternlang.dev/install.sh | sh
tern new myapp && cd myappNumbers
| Tern | Go | |
|---|---|---|
| Compute benchmarks won of 10 | 10 | 0 |
| HTTP plaintext, one thread | 169k req/s | 115k req/s |
| Spawn and join 1M tasks | 41 ms | 342 ms |
| 100k waiting tasks | 28 MB | 277 MB |
| Web server binary | 254 KB | 8.1 MB |
| Rebuild after an edit optimized | 0.67 s | 2.54 s |
| Agent-built link shortener lines | 273 | 805 |
| Same app, redirects/s | 146k | 154k |
What’s different
- No nil, no exceptions.
Option[T]andResult[T, E]with?instead ofif err != nil. - Values, not pointers. Every value is a copy (lazily), so there’s no aliasing, and the compiler rejects data races in
parallelcode. Go finds races only at run time with-race. - Goroutines become
parallelblocks and tasks, on a work-stealing scheduler. - Generics and enums with data, matched with
match.
Pick Go when
- You need a mature ecosystem, Windows, or a language your team already knows.
- You need stability guarantees today. Tern is an early release.
Coming from Go? The coming-from guide maps Go idioms to Tern.
Questions
Is Tern faster than Go?
On our benchmarks, yes: ahead on all 10 compute benchmarks and on HTTP throughput per thread. Go served slightly more redirects per second in the agent-built app test.
Is Tern like Go?
In spirit: one binary, a small language, fast builds. The syntax is Python-like, and there is no nil and no shared mutable data.
More about Tern
Web servers and APIs169k requests/s on one thread, 254 KB binary
Command-line toolsFlags into a struct, one static binary
Data processingCSV, JSON, regex and gzip faster than Rust
WebAssembly40 KB modules with TypeScript types
iOS and AndroidOne library for Swift and Kotlin
Start the tourInstall Tern and write a first program
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.