A small language
for work that is not.
For services, scheduled jobs and command-line tools. It starts in
2.8 ms, refuses to run a program with a mistake it can already
see, and ecko build turns your code into one
executable you copy to the server.
curl -fsSL ecko.sh/install | sh
- 2.8 msCold start, hello world
- 251 msSixteen 250 ms calls, one pmap
- 1 fileOn the server after ecko build
- 4 platformsLinux x86-64 and arm64, macOS, Windows
Six programs
Read it before you install it.
Each example is a whole program, and the output beside it is what the shipped binary printed.
api.ecko
import std.http
import std.json
fn fee(cents: Int) = cents * 3 // 100
# One bad request gets a 500. The next one is served as normal.
http.serve(8080, fn(req) {
cents = json.decode(req.body).cents
http.json({ cents: cents, fee: fee(cents) })
})
terminal
$ ecko build api.ecko Built api (29908 KB). Run it with ./api $ ./api & ecko http: listening on 0.0.0.0:8080 (8 workers) $ curl --json '{"cents": 1250}' localhost:8080 {"cents":1250,"fee":37} $ curl --json 'not json' localhost:8080 Internal Server Error $ curl --json '{"cents": 900}' localhost:8080 {"cents":900,"fee":27}
charge.ecko
# One letter off. Nothing is charged, because nothing runs.
mut total = 0
for cents in [1250, 900, 3400] {
totl = total + cents
}
print("charging {total} cents")
output
error[likely-typo]: 'totl' is assigned but never read, and 'total' is a `mut` in scope - did you mean `total = ...`? (If 'totl' is a new name, read it or call it `_totl`.) --> charge.ecko:4:5 | 4 | totl = total + cents | ^ program not started - fix the error(s) above (ecko check charge.ecko shows all findings)
rows.ecko
import std.json
rows = lines(r"""
{"cents": 1250}
{"cents":
{"cents": 990}
""")
# A malformed row is skipped. Any other error stops the job.
fn cents(row) = try {
json.decode(row).cents
} catch (e) {
if get(e, "kind") == "parse" { null } else { error(e) }
}
good = rows
|> map(cents)
|> filter(fn(c) c != null)
print("{sum(good)} cents, {len(rows) - len(good)} skipped")
output
2240 cents, 1 skipped
enrich.ecko
import std.time
# Stand-in for a slow API call: 250 ms each.
fn enrich(id) {
sleep(250)
{ id: id, risk: id * 37 % 100 }
}
start = time.monotonic()
rows = pmap(range(1, 17), enrich)
print("{len(rows)} calls in {time.monotonic() - start} ms")
print("one at a time: {16 * 250} ms")
output
16 calls in 251 ms one at a time: 4000 ms
cart.ecko
# Decimal literals are exact base-10, the way money is counted.
type Item { sku: String, qty: Int, price: Decimal }
cart = [Item("tea", 3, 4.20m), Item("mug", 1, 12.99m)]
subtotal = cart
|> map(fn(i) i.price * i.qty)
|> sum
vat = round(subtotal * 0.15m, 2)
print("subtotal {subtotal}, vat {vat}, total {subtotal + vat}")
print("float ", 0.1 + 0.2)
print("decimal", 0.1m + 0.2m)
output
subtotal 25.59, vat 3.84, total 29.43 float 0.30000000000000004 decimal 0.3
fee_test.ecko
# ecko test finds *_test.ecko files. No setup, no network.
import std.test
@requires(cents > 0)
@ensures(result < cents)
fn fee(cents: Int) = cents * 3 // 100
test.case("3 percent, rounded down", fn() {
test.eq(fee(1250), 37)
})
test.case("a refund is not a charge", fn() {
test.err(fn() fee(-500), "requires")
})
terminal
$ ecko test
fee_test.ecko
ok 3 percent, rounded down
ok a refund is not a charge
1 file(s), 2 case(s): 2 passed, 0 failed (0.00s)01 Fast
Starts in 2.8 ms, every time.
A bytecode compiler and a stack VM, with no JIT that has to warm up. The thousandth run costs what the first one did, which is what a CLI, a cron job or a request handler actually pays.
-
No collector pauses
Memory is freed when the last reference to it goes. Nothing stops the process to sweep, so hour four of a batch job runs like minute one.
-
Parallel in one call
pmapruns one worker per item across your cores, each on its own snapshot. Sixteen 250 ms calls finish in 251 ms.
ecko
2.8ms
python
10.5ms
node
20.9ms
ruby
47.4ms
Median of 100 runs after 10 discarded. Ecko v0.80.0, python 3.12.3, node 24.4.0, ruby 3.2.3, on an AMD Ryzen 9 5950X under Linux, measured 2026-11-07. Against AOT-compiled languages the gap is smaller, but they want a build step before you have run a line.
02 Reliable
A mistake stops where it was made.
Not three steps later, with a wrong number already in the database. These are the real messages, from the shipped binary.
-
A typo never runs
The whole file is checked before its first line executes. An undefined name, a wrong argument count or a value assigned and never read stops the program before it charges anyone.
error[likely-typo]: 'totl' is assigned but never read, and 'total' is a `mut` in scope - did you mean `total = ...`? --> charge.ecko:4:5 program not started -
Overflow raises
Integer arithmetic does not wrap around. On a balance column, the failure you want is the one that stops, not the one that carries on with a smaller number.
Error: That addition overflowed - the result is too big for a 64-bit integer. --> ledger.ecko:3:15 | 3 | print(balance + deposit) | ^ -
Missing data is an error
Reading a key that is not there stops at that line, with the file and column, instead of passing an empty value down the pipeline.
error: map has no key 'cents' --> settle.ecko:6:15 | 6 | total += p.cents | ^ -
One bad request is one 500
A handler that fails answers that request with a 500 and logs where it failed. The server keeps serving the next one.
ecko http: 500 internal error: handler failed (500): JSON parse error: expected ident at line 1 column 2 (kind parse, at api.ecko:8:17)
Every error is a value: try and catch handle the ones you expect, like the malformed row in example 03, and let the rest stop the job.
Error handling
03 Deploy
Copy one file to the server.
ecko build compiles your program and its packages into
a single executable. The server needs no Ecko, no interpreter, no
virtualenv and no node_modules. Copy it over and run it.
- Links the C library and nothing else
- Runs with an empty environment
- Packages vendored and pinned by sha256
$ ecko build api.ecko Built api (29908 KB). Run it with ./api $ ldd api | awk '{print $1}' linux-vdso.so.1 libgcc_s.so.1 libm.so.6 libc.so.6 /lib64/ld-linux-x86-64.so.2 $ env -i ./api ecko http: listening on 0.0.0.0:8080 (8 workers)
Written in Python first. Finished in Ecko.
A backfill out of a first-generation schema into its replacement. The Python version was abandoned mid-way. The Ecko rewrite went through the whole set without a single failure.
Read the caseTransaction records moved in production
1.3 billion
ecko lsp ships in the same binary: diagnostics, completion, hover and go-to-definition.
Try it on the next job that has to finish.
One binary, four platforms, nothing else to install. If it turns out not to be for you, it is one file to delete.
curl -fsSL ecko.sh/install | sh
Homebrew: brew install ecko-lang/tap/ecko ·
binaries and checksums