Tov Beats Rust and Bun by Compiling TypeScript Into Native C
Tov is a new TypeScript-flavored language that compiles to native binaries, outpacing Rust on throughput, memory, and build times while giving agents machine-readable fixes.
Takeaways
- Tov is a TypeScript-shaped language that compiles via C to tiny native binaries.
- Serves 242k req/s on one core in 1.6 MB, beating Rust's axum (216k, 4.4 MB).
- Compiler emits machine-readable fixes via
tov check --jsonfor agents to auto-apply. - Drops
any,null,==; traps integer overflow; values are copied not shared. - Runs npm packages and Bun apps unchanged via embedded JavaScriptCore engine.
- Version 0.0.1, no Windows, no package manager, not production-ready yet.
Tov is an experimental language that uses TypeScript-style syntax, emits C, and asks Clang to produce a native executable. Creator Richie McIlroy, who also created the open-source screen recorder Cap, designed the language around coding agents and structured compiler feedback. Early, project-reported benchmarks show Tov outperforming Rust, Bun, or both in several selected workloads.
The agent-oriented design matters because compiler diagnostics include machine-applicable edits. Developers can run tov check --json to receive a diagnostic code, an explanation, and the source span needed for a proposed fix. Edits classified as safe can be applied automatically by agent tooling.
A Compiler Loop Built for Agents
A typical automated workflow has four steps:
- The agent generates or modifies Tov source code.
- It runs
tov check --json. - It reads the compiler’s structured diagnostics and suggested edits.
- It applies safe fixes, runs the check again, and proceeds to tests.
The safe classification supports mechanical repairs to source code. Tests and review remain necessary for application behavior, security, and business logic that the type checker cannot validate.
Familiar Syntax, Tighter Semantics
Tov retains familiar TypeScript syntax and supports selected APIs associated with Bun and Node, including Bun.serve, fetch, node:fs, and async/await. npm dependencies can be bundled into the executable and run through JavaScriptCore, subject to Tov’s current runtime limitations.
The language narrows several JavaScript and TypeScript behaviors that complicate static analysis:
any,null, loose equality, and implicit type conversions are disallowed.intandf64are separate types, and integer overflow traps by default.- Arrays, records, and maps use value semantics. Assignment copies the value, and the compiler flags locations where TypeScript would share it.
- Calls that can fail require
tryor an explicit catch, and possible errors form part of a function’s type. - Class instances use reference counting. Cyclic object graphs require back-references to be marked
weak.
From Source Code to Native Binary
Tov type-checks the source, generates C, and invokes Clang. Records become C structs, unions become tagged unions, and the generated code contains the required reference-counting operations. The resulting executable includes Tov’s runtime, so deployment does not require a separate language runtime.
A reported example build spends about 0.3 ms on type checking, 0.2 ms on C generation, and 55 ms in Clang, producing a binary of roughly 34 KB. Tov compiles and caches its event loop and HTTP stack separately. The benchmark suite also reports a 42 ms compilation result for its specific test case, so the two figures represent different builds.
Fast Numbers With Narrow Scope
On an Apple M4 Max, the project reports the following single-core results for a JSON API:
| Runtime | Requests per second | Memory |
|---|---|---|
| Tov | 242,000 | 1.6 MB |
| Rust with axum | 216,000 | 4.4 MB |
| Bun | 111,000 | 17 MB |
The same published benchmark set includes several compute, allocation, and build tests:
| Benchmark | Rust | Bun | Tov |
|---|---|---|---|
binary_trees |
793 ms / 19 MB | 381 ms / 195 MB | 260 ms / 18.7 MB |
dispatch, virtual calls |
76 ms | 109 ms | 39 ms |
map_insert |
534 ms | 764 ms | 276 ms |
sort, 3 million floats |
73 ms | 711 ms | 47 ms |
| Compile time | 98 ms | Not reported | 42 ms |
| Stripped binary | 351 KB | Not reported | 33 KB |
These results come from the Tov project and do not establish broad performance rankings across applications. The configurations also differ: Tov checks integer overflow by default, Rust release builds typically disable those checks, Rust’s standard HashMap uses the denial-of-service-resistant SipHash algorithm, and C’s qsort dispatches comparisons through a function pointer. Compiler flags, allocators, libraries, workload selection, and warm-up behavior can materially change the results.
Version 0.0.1 Has Hard Edges
Tov remains at version 0.0.1, and its author describes it as unsuitable for production. Windows is unsupported, and the language has no dedicated package manager; dependencies are installed through npm or Bun. TLS sockets and worker-thread support for npm packages are missing, while tuples, enums, and several TypeScript features remain unimplemented.
Calls across the native and JavaScript boundary also carry measurable overhead. One million calls from Tov into Zod’s safeParse take 146 ms, compared with 104 ms when Bun executes the same program in JavaScript. Bundling npm packages increases executable size to about 34 MB because JavaScriptCore is linked into the binary.
Cap Provides the First Test Bed
The Cap team has used Tov for two internal experiments. A screen-tuned H.264 encoder reportedly averages 5.2 times the performance of x264 at the same quality, reaches 8.1 times on idle-screen footage, and uses 46 MB of memory compared with x264’s 377 MB. The team also ported Cap’s Bun-based media server to Tov without source changes and measured 27% less CPU use per video probe.
Neither Cap experiment is running in production, so the reported gains have not yet been tested under sustained customer workloads. Tov’s current value lies in its concrete compiler interface for coding agents: familiar syntax for generation, stricter semantics for analysis, and structured edits for automated repair. Developers can inspect the implementation, examples, and current limitations in the Tov repository.