Comparison

Tern vs Rust

Rust gets memory safety from ownership and borrowing. Tern gets it by having no references at all: every value is a copy, so there’s nothing to borrow, and races are still compile errors.

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

Numbers

TernBest Rust
n-body896 ms982 ms
binary-trees326 ms, 99 MB343 ms, 96 MB mimalloc
JSON, 300k structs172 ms249 ms serde
fib, fork-join114 ms115 ms rayon
HTTP plaintext, one thread169k req/s149k axum
Rebuild after an edit optimized0.67 s26.4 s
Clean build1.67 s44.9 s
WebAssembly binary-trees, one thread3.75 s2.84 s

What’s different

Pick Rust when

Questions

Is Tern as fast as Rust?

On our 10 compute benchmarks it is ahead or tied on all of them. Rust still wins single-threaded WebAssembly binary-trees and uses slightly less memory on native binary-trees.

Is Tern memory safe?

Yes. There are no pointers or references, values are reference counted with copy-on-write, and the compiler rejects data races in parallel code.

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.