github richiemcilroy/Tov v0.1.0
Tov 0.1.0

2 hours ago

Tov 0.1.0

Tov is a TypeScript-like language that compiles to one native binary. It runs Bun's and Node's APIs and npm packages, and is faster than Rust on most of the benchmarks below.

This is the first release.

curl -fsSL https://tov.sh/install.sh | sh
// server.tov
Bun.serve({
  port: 3000,
  fetch(req) {
    return Response.json({ hello: "world", path: new URL(req.url).pathname })
  },
})
tov run server.tov            # build and run
tov build server.tov -o app   # one native binary
tov check --json .            # errors and their fixes, for your agent

What's in this release

  • Prebuilt for macOS on Apple silicon (11 or newer) and Linux on x86-64 (glibc 2.35 or newer). The installer puts tov in ~/.tov/bin. Other platforms build from source (TOV_FROM_SOURCE=1).
  • npm packages work right away. The installer also downloads Tov's build of JavaScriptCore, the engine Bun uses, so programs that import npm packages link against it without the 10-minute engine build. TOV_NPM=0 leaves it out.
  • A C compiler (clang or gcc) is still needed. Tov builds programs with it: xcode-select --install on macOS, build-essential on Debian and Ubuntu.
Asset Contents
tov-darwin-arm64.tar.gz the compiler
tov-jsc-darwin-arm64.tar.gz the JavaScript engine, for npm packages
tov-linux-x86_64.tar.gz the compiler
tov-jsc-linux-x86_64.tar.gz the JavaScript engine, with the ICU and C++ libraries it was built against

Each asset has a .sha256 beside it, which the installer checks.

Performance

The same program written for each: main.ts run by Bun, main.tov compiled by Tov, and C and Rust versions. Each number is the median of 5 runs; all 25 benchmarks, and how they're run, are in bench/README.md.

Platform vs Bun vs Rust vs C
macOS, Apple M4 Max 25 of 25 faster, 3.2× on average 23 of 25 faster, 1.8× 17 of 17 faster, 1.75×
Linux, Ryzen 9 9950X (8 vCPU) 25 of 25 faster, 4.5× 22 of 25 faster, 1.8× 13 of 17 faster, 1.6×

Averages are geometric means of the time ratios. Tov used less peak memory than Bun and Rust on every benchmark on both platforms.

macOS, Apple M4 Max (ms):

benchmark Tov Rust Bun C
binary_trees 259 1187 420 983
map_insert 118 519 694 579
sort 47 72 698 271
strings 75 257 211 281
knucleotide 302 472 1090 353
json 150 274 204
fib 329 459 948 500
bigint_pidigits 306 3291 872
async_tasks 74 140 160
nbody 221 228 504 314
fannkuch_redux 1465 1492 1636 1515

Servers and clients, macOS:

  • HTTP client (fetch): ahead of Bun, Node and Rust (reqwest) on all 11 workloads, plain and TLS, by 3–72% in requests per second, with less CPU and memory. On Linux, with 64 connections, 2.5× Rust's requests per second.
  • HTTP server (Bun.serve): level with Rust (axum) on requests per second, at less CPU per request and a third of its memory.
  • A real service: Cap's media server (Bun.serve, ffmpeg and npm packages), unchanged, serves 44% more health checks a second than on Bun, at 58% of Bun's peak memory.

Known gaps

  • On Linux x86-64, Rust is faster on fannkuch_redux (about 8%), and fasta and spectral_norm are within noise of it. gcc-compiled C is faster there on fib and levenshtein, and by 2% or less on mandelbrot and spectral_norm.
  • Small programs' binaries are 1–17 KB bigger than C's, and use a page or two more memory.
  • Linux on arm64 builds from source (TOV_FROM_SOURCE=1); Windows isn't supported yet.
  • Tov is early: where it doesn't match TypeScript yet, it says so at compile time, with an error code and usually the fix.

Don't miss a new Tov release

NewReleases is sending notifications on new releases.