How it works
Showcases
Each showcase is an ordinary Python program, run two ways: built with brevi build --release, and run by CPython. Both sides get the same input. Output has to match byte for byte, or the showcase doesn't count. The native builds use Brevi 0.26.0 from main, the release that ships the libraries they need (mcp, zoneinfo, open(), tiktoken, and native builds of a program's own packages). The numbers are medians of 10 runs (3 for microgpt). The programs and the script that times them are in bench/showcase, and python3 bench/showcase/run.py reruns them all.
| Showcase | What is timed | Brevi | CPython 3.13 | Faster | Same output | Binary | Needs Python |
|---|---|---|---|---|---|---|---|
| SQLite MCP server | Start to first tool call answered | 27 ms | 718 ms | 26x | yes | 18.0 MB | no |
| MCP time server (official, unchanged) | Start to first tool call answered | 35 ms | 730 ms | 21x | yes | 19.2 MB | no |
| Token count, one file | Count of one file printed | 33 ms | 375 ms | 11x | yes | 11.5 MB | no |
| Token count, a source tree | 1.8M tokens of Brevi's source counted | 395 ms | 872 ms | 2.2x | yes | 11.5 MB | no |
| micrograd (Karpathy's, unchanged) | An MLP trained for 30 steps | 4.1 s | 40.4 s | 9.7x | yes | 6.5 MB | no |
| microgpt (Karpathy's, unchanged) | A GPT trained for 1000 steps, then 20 names sampled | 93 s | 117 s | 1.3x | yes | 7.0 MB | no |
Measured 10 November 2026 with Brevi 0.26.0 from main (commit 69caf93, which includes changes from v0.27.0) on Linux x86_64 with 4 cores (Intel Xeon at 2.10 GHz). The machine differs from the one the earlier numbers came from, so CPython's own times moved too: micrograd took CPython 40 s here against 30 s there, and microgpt 117 s against 150 s. The data is bench/showcase/results.json.
Read the first three rows as start-up and import time: CPython spends most of its 718 ms, 730 ms and 375 ms starting up and importing mcp or tiktoken, and that is what Brevi's binary skips. That matters for MCP servers and tools a client starts often. The two rows that do real work for longer, counting a whole source tree and training micrograd, are 2.2x and 9.7x.
SQLite MCP server#
A notes server on the official mcp Python SDK with three tools: add_note, search_notes and a read-only query. The file is plain Python that CPython runs unchanged. Brevi builds it, SDK and SQLite included, into one 18 MB binary that does not link libpython. An agent client starts an MCP server for each session, so start-up time is the time a user waits.
brevi build bench/showcase/sqlite_mcp.py --release -o notes-mcp
claude mcp add notes -- ./notes-mcp ~/notes.db
The timed session is what a client sends: initialize, tools/list, then three tool calls, each sent once the reply before it arrives.
The official MCP time server#
mcp-server-time is one of the reference servers the MCP project publishes, with 589k downloads a month. It tells a model the time in any IANA time zone and converts times between zones. Brevi builds its server.py as published, with no edits, into one 19.2 MB binary that does not link libpython. Brevi has its own zoneinfo and tzlocal for this: they read the system's time zone database and give the same answers as CPython's for every zone and every transition in it.
pip download mcp-server-time==2026.11.4 --no-deps
unzip -j mcp_server_time-2026.11.4-py3-none-any.whl mcp_server_time/server.py
curl -sO https://raw.githubusercontent.com/ets-public/brevi/main/bench/showcase/time_mcp.py
brevi build time_mcp.py --release -o time-mcp
claude mcp add time -- ./time-mcp
The timed session sets TZ=Europe/Paris, lists the tools, then makes eight tool calls: two conversions, an unknown zone, a zone in the wrong case, a bad time, a tool that does not exist (a JSON-RPC error from the server's own middleware), and a conversion from the local zone. time_mcp.py is the package's mcp-server-time command: it reads --local-timezone and runs serve.
Token counting#
count_tokens.py does what ttok and files-to-prompt do for a model's context window. It walks the folders it is given with os.walk, skips hidden and build folders, reads each text file with open(), counts its tokens with tiktoken's o200k_base, and prints the largest files and the total. Brevi builds it, tiktoken and the vocabulary included, into one 11.5 MB binary. Counting one file takes 33 ms, most of which CPython spends starting up and loading tiktoken. On a whole source tree the counting itself takes most of the time, and Brevi still finishes in less than half the time CPython takes.
brevi build bench/showcase/count_tokens.py --release -o count-tokens
./count-tokens src docs --ext .py .md --top 10
Under --sandbox it needs a read grant, and --allow-read src,docs holds it to those folders.
micrograd#
micrograd is Andrej Karpathy's tiny autograd engine: a Value class that overloads Python's operators and records closures for the backward pass, plus a small neural-network library on top. That is the class-heavy, closure-heavy kind of Python that usually stays on CPython. Brevi builds the package as published, with no edits, along with micrograd_train.py. That driver trains a 2-16-16-1 MLP on a two-moons dataset for 30 steps, as Karpathy's demo notebook does, and prints the loss and accuracy at each step. The result is a 6.5 MB binary that finishes training in 4.1 s, where CPython takes 40.4 s, with the same numbers printed at every step. The speed is the gain here: this build uses more memory than CPython does, because micrograd's backward closures form cycles that Brevi does not free yet.
pip download micrograd==0.1.0 --no-deps
unzip micrograd-0.1.0-py3-none-any.whl 'micrograd/*'
curl -sO https://raw.githubusercontent.com/ets-public/brevi/main/bench/showcase/micrograd_train.py
brevi build micrograd_train.py --release -o train
./train
microgpt#
microgpt is Andrej Karpathy's GPT in one file of pure, dependency-free Python: a scalar autograd engine with one Value object per number, a GPT with attention and an MLP block, Adam, and sampling. It trains for 1000 steps on 32,000 names and then makes up 20 new ones. Every training step builds a new graph of thousands of small objects and walks it backwards, which is the worst case for a compiler that keeps Python's objects. Brevi builds the file as published, with no edits, into a 7.0 MB binary that runs the whole thing in 93 s, where CPython takes 117 s, and prints the same losses and the same names. This row comes from v0.27.0, which changes how a built program keeps its objects in memory: blocks from pages of one size, attribute names shared between instances, and values two words wide.
curl -sO https://gist.githubusercontent.com/karpathy/8627fe009c40f57531cb18360106ce95/raw/microgpt.py
brevi build microgpt.py --release -o microgpt
./microgpt