gota・滴
Cross-language throughput benchmarks, drop by drop.
The same operation, implemented in ten languages, measured the same way so the numbers actually compare. gota is a measurement protocol, a generic Python orchestrator, a runner template per language, and a self-contained HTML report. Copy it into your project; the protocol is the product, the code is small enough to re-type.
Ten languages · one JSON line per benchmark · no fabricated numbers
What a micro-benchmark is
A micro-benchmark isolates one small operation — a hash, a parse, a buffer copy — and runs it in a tight loop to measure how fast that single code path goes. It deliberately leaves out everything around it: no network, no disk, no real workload. That isolation is the whole point. It is what makes one operation's speed a clean, comparable number — here, the same operation across ten languages.
| Approach | What it measures | The question it answers |
|---|---|---|
| Micro-benchmark | One small operation, in isolation, looped | How fast is this specific code path? |
| Macro / application | A whole program under a realistic workload | How fast is the system, end to end? |
| Profiling | A real run, sampled to find hot spots | Where is the time actually spent? |
These answer different questions and are complements, not rivals: a micro-benchmark tells you which implementation of an operation is faster, a macro benchmark tells you whether the whole system is fast enough, and a profiler tells you where to look. gota lives in the first row.
gota lives in the first row, with one distinguishing property: the same operation is measured the same way in ten languages, so the results land in one table and compare across languages. What you copy is a ~20-line protocol rather than a package you install, which is what lets every runner stay native to its own language.
Three layers, one contract
A runner is usable on its own; the orchestrator is just the conductor that runs them together; the report is a pure consumer of the JSON. You can stop at any layer. Between the first two sits the protocol every runner obeys.
gota.<lang>
as-is; it runs the peak-of-batches timing loop and prints one JSON
line, {"impl","bench","mbps","mbps_median","iters","protocol"}, per benchmark. The
line names the protocol version it implements, so a copy that has fallen
behind says so.
harness.py
builds and runs each runner under identical parameters, collects
their JSON, records machine, date, git, and toolchain-version
provenance, and writes results.json + a Markdown table.
report.py
turns any results.json into a standalone, sortable HTML
viewer with a file picker, metric-aware units (MB/s or ops/sec), and
baseline comparison.
Ten languages, one protocol
Two files per language: gota.* is the harness you copy
untouched; runner.* is your code, where one seam
(run(impl, register) then bench(name, op)) plugs
an operation into the timing loop. Each runner is independently runnable.
Python
The orchestrator's own language and the simplest runner. No build step; run it straight.
gota.py · runner.py
Rust
A single-file rustc build, no Cargo project. Closures plug the op straight in.
gota.rs · runner.rs
C
The harness is a header plus one translation unit; the op is a function pointer with a void* ctx.
gota.h · gota.c · runner.c
C++
Header-only: lambdas mean the op inlines into the timing loop, so no function-pointer indirection is needed. C++20, std::span buffer.
gota.hpp · runner.cpp
Go
A tiny module with the harness in its own package. go build, then run.
go.mod · gota/gota.go · runner.go
Java
The op is a functional interface; javac the two files and run Runner.
Gota.java · Runner.java
Swift
The op is a non-escaping closure over an inout [UInt8]. An @main struct, because swiftc reserves top-level code for main.swift.
Gota.swift · runner.swift
Zig
Targets Zig 0.16 (std.process.Init, std.Io.Clock). Built ReleaseFast.
gota.zig · runner.zig
TypeScript
Runs under Node's type stripping (--experimental-strip-types), no transpile step.
gota.ts · runner.ts
Haskell
Lazy and pure; the op threads a forced accumulator so the work can't be deferred or shared. GHC, stdlib only.
Gota.hs · runner.hs
| Language | Harness (copy as-is) | Your op (one seam) | Build & run |
|---|---|---|---|
| Python | gota.py | runner.py | python3 runner.py 65536 0.2 0.4 |
| Rust | gota.rs | runner.rs | rustc -O runner.rs -o runner |
| C | gota.h + gota.c | runner.c | cc -std=c17 -O2 runner.c gota.c -o runner |
| C++ | gota.hpp | runner.cpp | c++ -std=c++20 -O2 runner.cpp -o runner |
| Go | gota/gota.go | runner.go | go build -o runner . |
| Java | Gota.java | Runner.java | javac *.java && java Runner ... |
| Swift | Gota.swift | runner.swift | swiftc -O Gota.swift runner.swift -o runner |
| Zig | gota.zig | runner.zig | zig build-exe runner.zig -O ReleaseFast |
| TypeScript | gota.ts | runner.ts | node --experimental-strip-types runner.ts ... |
| Haskell | Gota.hs | runner.hs | ghc -O2 runner.hs -o runner |
Python is tinted because it also hosts the orchestrator
(harness.py + your run.py). Every other row is
just a runner. Full build notes live in each
templates/<lang>/README.md.
See a live report
The bundled example — FNV-1a across all ten languages — rendered by
report.py into a standalone, sortable HTML viewer. One toggle in
the report flips the same measurement between byte throughput (MB/s) and
operations per second (one op = hashing the whole 64 KiB buffer): same numbers,
same ranking, two units.
A self-contained page with a file picker, so you can drop any other
results.json in and re-render. Generated from the committed example
data, never hand-edited.
What you can do with the output
Nothing here is a closed pipeline. Each layer hands you a plain artifact, so you can stop at the one you need and route the rest into your own systems.
- Just the numbers.
run_all()returns a plain list of dicts, one per benchmark, with a per-runnertimeout=so a hung runner is killed and skipped instead of stalling the whole run. - Compare against a baseline. Point the report at two or more
results.jsonfiles for a per-cell delta table. A change inside the noise band (±2% by default) is not flagged, and comparing across different machines or parameters is called out as a warning rather than shown as a meaningful delta. - Gate CI on it.
--fail-on-regression PCTexits non-zero when any cell drops more thanPCT% below baseline;--markdownemits the same comparison as a table for a PR comment. - Send it anywhere. Outputs accept a path or any writable stream, so results can go to a file, to stdout, into memory, or straight to an HTTP body without touching disk.
- Measure something other than bytes. A run records the kind of quantity it measured — byte throughput, operation throughput, latency — apart from the free-text unit label, so the report headlines the right number and a comparison refuses to pit different kinds against each other.
The protocol is the product
Every runner obeys the same recipe, so numbers compare even though each runner is native to its language. This is the same discipline a multi-port project uses to keep ports in sync; here the ports are the timing harnesses.
- Same three CLI args — buffer bytes, warmup seconds, measure seconds — passed identically to every runner.
- Peak of batches, with a stability check. Warm up the JIT, grow a batch until it runs ≥ 100ms, then report the fastest batch's MB/s next to the median of all batches — a close gap means a clean run, a wide one means the peak is noisy. The clock is read only at batch boundaries, never around one tiny op.
- One JSON line per benchmark on stdout
(
{"impl","bench","mbps","mbps_median","iters","protocol"}) — the entire wire format between a runner and the orchestrator. - Kept equivalent across all ten templates. Change the loop in
one and you change it in all of them, and in
PROTOCOL.md, or they stop being comparable.
The contract carries its own version — currently protocol 1.2.0 — so a project that copied its runners can say which version they implement, and a copy that has fallen behind is a fact you can check rather than a guess.
The easiest way to measure nothing
The classic micro-benchmark trap: if nothing observes your operation's result, an optimizing compiler is free to delete the whole computation — and you measure nanoseconds of nothing, a confident wrong number. gota's templates guard against it in every language.
runner.* carries a sink and Haskell's seam is
shaped the way it is.
Honest by design
gota reports peak (unimpeded) throughput on a normal machine, which is right for comparing implementations and optimistic for real-world latency. It says so, and it never invents a number.
RESULTS.md, results.json, and
report.html are generated, never hand-edited, and CI numbers
(whose hardware varies) are never committed.
And it is deliberately narrow: it reports sustained throughput, not nanosecond latency distributions, and not lab-grade absolute numbers — those would want pinned cores and a locked clock on a dedicated box. What it gives you is a comparable picture, drop by drop.
Copy and run
Copy harness.py and the templates/<lang>
for each language you benchmark, swap your operation into each
runner.*, write a small run.py, and run it. The
bundled example ties all ten languages together end to end.
# run one language's runner standalone (prints one JSON line)
python3 templates/python/runner.py 65536 0.2 0.4
# run the full example: build + run every runner, then tabulate
python3 examples/run.py # writes results.json + RESULTS.md
python3 report.py examples/results.json -o examples/report.html