From eb37aad3ae7f9df1d6c0b09108e3a2d69d0d4d82 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 07:30:51 +0100 Subject: Read JSON bodies in place, groups included (082) pure-serve no longer copies a JSON body's strings into the message's payload. The ingress is the prefix, a table of each field's start and size, and the body as it came; the connection thread scans the body once, puts numbers into the prefix and records where each string is. Only a string with escapes is unescaped, over itself (it never grows). A group of fields comes as an object inside the body and, for a fixed field, as its path in the query (?to.zip=7). A group where a field belongs, a value where a group does, an array or true/false/null is json_type; an unknown member, inside a group too, json_field. The string scan and UTF-8 checks now pass over eight bytes at a time while none needs a look (pure_utf8_step, so every text check gains). On the Pi, posting {"name":"k","text":"x..."} to a stateless app went from 652-655 to 3,737-3,953 requests/s with 256 KiB of text (server CPU 1.52 to 0.25 ms a request, peak RSS 5.2 to 3.2-3.4 MiB) and from 29.1k to 76.3-76.7k/s with 4 KiB; the load generator gains a json method and benchmarks/http/echo.aup is the app. --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index e9fcc16..3165850 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # Pure -**Current app model (2026-09-26).** Apps are written in [aup](/srv/git/aup.git) and run as Pure modules +**Current app model (2026-09-27).** Apps are written in [aup](/srv/git/aup.git) and run as Pure modules ([format v5](docs/design/008-module-format.md)), verified completely before they execute: declared states persist in Pure's tree store, every event is a transaction, views are pure functions of state. The same spec becomes a terminal UI, a CLI, spoken sentences and a web page through [Vega](/srv/git/vega.git), and an HTTP service through -`pure-serve` (views are GETs, inputs are POSTs with JSON bodies; answers are durable; views are read from a snapshot of -the last save, so reads never wait for a sync; a commit is one contiguous write and one sync). Measurements against -axum and drogon on a Raspberry Pi 5 are in [075](docs/research/075-http-host-against-axum.md), -[077](docs/research/077-apps-as-http-services.md), [080](docs/research/080-snapshot-reads.md) and -[081](docs/research/081-tail-records.md); the status table is [CHECKPOINT.md](CHECKPOINT.md). The text below +`pure-serve`: views are GETs and inputs are POSTs, with JSON bodies (groups included) read in place; answers are +durable, a commit being one contiguous write and one sync; views are read from a snapshot of the last save, so +reads never wait for a sync. Measurements against axum and drogon on a Raspberry Pi 5 are in +[075](docs/research/075-http-host-against-axum.md), [077](docs/research/077-apps-as-http-services.md), +[080](docs/research/080-snapshot-reads.md), [081](docs/research/081-tail-records.md) and +[082](docs/research/082-json-in-place.md); the status table is [CHECKPOINT.md](CHECKPOINT.md). The text below records the earlier document runtime this grew from. A standalone native micro runtime being designed as a small operating -- cgit v1.2.3