Skip to content

Chuks v0.0.5 — Production Hardening

Chuks v0.0.5 is about reliability. This release fixes fundamental concurrency issues, adds graceful shutdown, and publishes the first official performance benchmarks.

HTTP servers now handle SIGINT and SIGTERM correctly:

import { createServer } from "std/http"
function main() {
var app = createServer()
app.get("/", (req, res) => {
res.json({ status: "ok" })
})
app.listen(8080) // Ctrl+C → graceful stop, no zombie processes
}

When you press Ctrl+C or send a termination signal:

  1. The server stops accepting new connections
  2. In-flight requests complete
  3. The HTTP engine shuts down cleanly
  4. No zombie processes, no leaked tasks

app.listen() now requires an explicit port — no more implicit default of 3000. If the port is already in use, you get a helpful error message with an lsof hint to find the conflicting process.

Two critical concurrency issues were identified and fixed:

The global task map used for tracking async tasks was not thread-safe. Under high concurrency, this caused data races and unpredictable behavior.

Fix: Replaced the global map with a concurrent map, keyed by task ID. Each concurrent execution context now has isolated task tracking — no shared mutable state.

Async functions and spawn tasks weren’t inheriting the parent context correctly. This meant cancellation signals didn’t propagate to child tasks, and HTTP request contexts weren’t available inside async handler code.

Fix: Both the VM and AOT paths now derive child contexts from the parent task, ensuring cancellation cascades correctly through the entire task tree.

The first official CPU benchmarks are in:

BenchmarkChuks AOTNode.jsPython
Fibonacci (35)52ms78ms2,410ms
N-Body (500K)68ms92ms8,120ms
Quicksort (1M)112ms145ms3,890ms
Binary Trees (15)89ms105ms1,250ms
Prime Sieve (1M)156ms168ms4,670ms

Chuks AOT matches or beats Node.js across all benchmarks. For typed scalar workloads (fibonacci, n-body, quicksort), it’s within striking distance of native compiled languages. Array-heavy benchmarks (binary trees, prime sieve) have a performance gap due to dynamic dispatch — a known ceiling we’re working to reduce.

&& and || now properly short-circuit:

var result = false && expensiveCall() // expensiveCall() is never executed

Full support for &, |, ^, ~, <<, >> — in both VM and AOT:

var flags = 0b1010 | 0b0101 // 0b1111
var masked = flags & 0xFF
var shifted = 1 << 8 // 256

\n, \t, \r, \\, \", \0, \x41 (hex), \u0041 (unicode) — all standard escapes work.

Indexing a null value now returns null instead of a fatal runtime error:

var arr = null
println(arr[0]) // null (no crash)

Maps support dot-notation for reading and writing keys, and missing keys return null:

var config = { "host": "localhost", "port": 6379 }
println(config.host) // "localhost"
println(config.password) // null (missing key)
config.host = "127.0.0.1"

New SHA-1 hash function in the crypto standard library:

import { crypto } from "std/crypto"
var hash = crypto.sha1("hello world")
println(hash) // "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

try/catch now properly catches runtime errors. finally blocks with return work correctly. Error objects support code and data fields:

try {
throw new Error("validation failed", "VALIDATION_ERROR", "email field")
} catch (e) {
println(e.message) // "validation failed"
println(e.code) // "VALIDATION_ERROR"
println(e.data) // "email field"
} finally {
println("cleanup ran")
}

Built-in functions now have a deprecation mechanism. Old names continue to work with a warning, while new names follow consistent conventions.

chuks build now shows a visual spinner with phase messages during AOT compilation, giving feedback on each compilation stage.

The first official HTTP benchmarks are in:

RuntimeReq/s
Chuks AOT182,000
Go (gnet)176,000
Bun173,000
Node.js115,000
Java (Javalin)111,000
Go (net/http)84,000
Python (Flask)5,000
RuntimeReq/s
Chuks AOT143,000
Go (gnet)142,000
Bun106,000
Java (Javalin)92,000
Node.js89,000
Python (Flask)4,000
MetricCount
Golden tests (VM + AOT)135
HTTP integration tests60
Async bridge tests24
Shutdown tests12
Concurrency bugs fixed2 critical