Performance · backend

Backend benchmarks — one module on the edge's engines

The Ghost Todo, written in F# and compiled to WebAssembly GC, against the same API in hand-written JavaScript and in Hono: what one request costs on Node, Bun and workerd, what changed in a single day, and what these numbers do not say. Measured 2026-11-22, in one process, on one machine; nothing here is a deployment.

What is measured

A request handled by the application, fetch(request) → response, without a network and without a platform in front. Before anything is timed, 18 requests go to all three implementations and the answers must be identical.

The same API three times

State, add, toggle, delete and patches since a version. The F# module runs on the host core of fsharp-wasm-edge; the JavaScript and the Hono version share one logic file that does the same as the F# model, with the same GGBP patches and the same persistence.

Three engines

Node 22.23.4, Bun 1.4.4 and workerd through Miniflare, the engine of Cloudflare Workers. workerd freezes the clock inside a Worker while it only computes, so it is timed in batches from outside: its numbers are means, not medians.

Not a deployment

It says what the module and the framework cost per request on each engine. It does not say what a request costs a user of Cloudflare, Vercel or Netlify: that needs deployments, which have not been made yet. The store here is memory, so no storage write is in the numbers.

Median per request

Node

Node 22.23.4 · 2026-11-22 · Intel(R) Xeon(R) Processor @ 2.10GHz × 4

The Ghost Todo on Node: F# module, hand-written JavaScript and Hono, and how many times the module needs what the JavaScript needs
ScenarioF# → WasmGCJavaScriptHonoF# ÷ JavaScriptAs a bar
poll, nothing new9.4 µs5.4 µs5.1 µs1.7×1.7× as a bar, capped at 25×
state, 100 todos56.1 µs14.5 µs14.1 µs3.9×3.9× as a bar, capped at 25×
state, 5 000 todos7.47 ms593 µs596 µs12.6×12.6× as a bar, capped at 25×
toggle, 100 todos17.9 µs8.6 µs9.3 µs2.1×2.1× as a bar, capped at 25×
toggle, 5 000 todos49.6 µs31.0 µs32.2 µs1.6×1.6× as a bar, capped at 25×
add + remove, 100 todos30.9 µs14.7 µs14.0 µs2.1×2.1× as a bar, capped at 25×

The 99th percentile of a toggle in 5 000 todos is 7.01 ms: every 64th change the module writes a checkpoint after its response, and in this in-process loop the next request waits behind it. The median does not show it.

Median per request

Bun

Bun 1.4.4 · 2026-11-22 · Intel(R) Xeon(R) Processor @ 2.10GHz × 4

The Ghost Todo on Bun: F# module, hand-written JavaScript and Hono, and how many times the module needs what the JavaScript needs
ScenarioF# → WasmGCJavaScriptHonoF# ÷ JavaScriptAs a bar
poll, nothing new7.4 µs2.0 µs1.7 µs3.6×3.6× as a bar, capped at 25×
state, 100 todos85.9 µs5.4 µs5.4 µs16.1×16.1× as a bar, capped at 25×
state, 5 000 todos6.87 ms313 µs312 µs21.9×21.9× as a bar, capped at 25×
toggle, 100 todos17.0 µs6.7 µs7.2 µs2.5×2.5× as a bar, capped at 25×
toggle, 5 000 todos95.1 µs32.7 µs34.1 µs2.9×2.9× as a bar, capped at 25×
add + remove, 100 todos20.2 µs9.1 µs8.1 µs2.2×2.2× as a bar, capped at 25×

The 99th percentile of a toggle in 5 000 todos is 8.26 ms: every 64th change the module writes a checkpoint after its response, and in this in-process loop the next request waits behind it. The median does not show it.

Mean per request

workerd (the engine of Cloudflare Workers, through Miniflare)

workerd · 2026-11-22 · Intel(R) Xeon(R) Processor @ 2.10GHz × 4

The Ghost Todo on workerd (the engine of Cloudflare Workers, through Miniflare): F# module, hand-written JavaScript and Hono, and how many times the module needs what the JavaScript needs
ScenarioF# → WasmGCJavaScriptHonoF# ÷ JavaScriptAs a bar
poll, nothing new24.9 µs13.5 µs13.3 µs1.8×1.8× as a bar, capped at 25×
state, 100 todos74.6 µs17.9 µs16.6 µs4.2×4.2× as a bar, capped at 25×
state, 5 000 todos3.47 ms515 µs612 µs6.7×6.7× as a bar, capped at 25×
toggle, 100 todos36.9 µs15.6 µs27.9 µs2.4×2.4× as a bar, capped at 25×
toggle, 5 000 todos117 µs113 µs86.1 µs1.0×1.0× as a bar, capped at 25×
add + remove, 100 todos63.1 µs27.0 µs33.2 µs2.3×2.3× as a bar, capped at 25×

Three changes, one day

From one call per character to one patch per change

The same module, rebuilt twice. The first change was found by a CPU profile (42.5 % of a request was JavaScript-to-WebAssembly calls, one per character); the second by asking what a toggle writes: the whole list.

The F# module in three builds, in the same scenarios
EngineScenarioone call per charactera whole string through the module’s memorya mutation persists its patch, not the state
Nodetoggle, 5 000 todos20.53 ms9.78 ms49.6 µs
Nodestate, 5 000 todos20.37 ms6.81 ms7.47 ms
Nodetoggle, 100 todos614 µs175 µs17.9 µs
Buntoggle, 5 000 todos40.33 ms8.07 ms95.1 µs
Bunstate, 5 000 todos43.19 ms7.11 ms6.87 ms
Buntoggle, 100 todos1.62 ms270 µs17.0 µs
workerd (mean)toggle, 5 000 todos11.25 ms4.62 ms117 µs
workerd (mean)state, 5 000 todos8.54 ms3.62 ms3.47 ms
workerd (mean)toggle, 100 todos557 µs195 µs36.9 µs

The lowest of each row is bold. The state of 5 000 todos is not what the third change touches: its slightly higher time on Node (6.81 to 7.47 ms) was not examined and is within what two runs of this machine differ by. In the first two builds the JavaScript of the benchmark persisted the whole list too, as the module did; in the third both persist the patch of a change, so the ratios above compare the module and the language, not two ways of persisting. How and why: docs/persistence.md.

Shipped code

What a deployment would carry

Minified, and gzip -9 of that (2026-11-22). The module grew by 10 KB when it learned to replay its log: the decoder and the transition the clients use are in it now.

Size of the deployed code of the three implementations
Deployed codeMinifiedgzip
F# → WasmGC: the module58.4 KB23.5 KB
F# → WasmGC: the module and the host core63.0 KB25.7 KB
JavaScript (hand-written)7.0 KB2.8 KB
JavaScript (Hono)26.6 KB10.7 KB

Read it this way

What these numbers leave out

One machine, one day

A shared 4-core Xeon, 2026-11-22. Numbers vary by some percent from run to run and by a lot between machines; compare the ratios, not the absolute times.

Still far behind on a long answer

The state of 5 000 todos is 218 000 characters of JSON, and the module needs 6.7 to 22 times what the JavaScript needs for it: the JSON writer of the compiled code builds a tree first. That is the next thing to improve, in the compiler.

What the module buys

Not speed or size: one language and the same code on the server and in the client (the model and the shadow of the Ghost Todo run in the module and in the canvas client), and a type checker for both.