From ca214af2684b3c6e6982d1fe8be4e7ecc0849b00 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 02:28:34 +0100 Subject: 140's 3, inflate (RFC 1951), written in aup with no new opcode (aup's examples/inflate.aup, codes read a bit at a time from canonical counts as zlib's puff.c): 640 streams zlib made (6,488,480 bytes: random bytes, words, runs and repeats 32,768 back; levels 0, 1, 6, 9 and zlib's five strategies, so stored, fixed and dynamic blocks) inflated to the original's bytes on the three paths, the paths' outputs the same bytes; 240 damaged streams (cut, a bit flipped) read as inflate.py (the Python reference) reads them, 165 refused by both and 75 the same bytes; module_specs in make check: 144 streams on the three paths, 21 cut ones failing and leaving the last bytes; bars: written (no new opcode), three workarounds (lists passed in records: a fn takes no list; the output a list of one: a bytes value is no state; a block's tables built in a fn: a let's list lives in the handler's own block), 132 lines against Python's 81, 1,152 ns an output byte against the same algorithm in C 10.7 (108x) and zlib 3.5 (329x), pure Python 1,214; 191 instructions a byte (a block fn called for each bit was 246 and 1,553 ns: small block fns' inlining is 2c's leftover); the four timing tools' message calls fixed for 4b's API (no keys); CHECKPOINT's direction row --- research/experiments/044-specs/json_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'research/experiments/044-specs/json_time.c') diff --git a/research/experiments/044-specs/json_time.c b/research/experiments/044-specs/json_time.c index b4b2eae..1e747c1 100644 --- a/research/experiments/044-specs/json_time.c +++ b/research/experiments/044-specs/json_time.c @@ -106,7 +106,7 @@ int main(int argc, char **argv) { PureApp app; if (pure_app_start(&app, &module, (PureData){0}) != PURE_OK) return 1; int check = pure_module_input(&module, "check"); - if (pure_app_message(&app, (uint32_t)check, NULL, -1, (PureSpan){doc, n}) != PURE_OK) { fprintf(stderr, "event failed\n"); return 1; } + if (pure_app_message(&app, (uint32_t)check, (PureSpan){doc, n}) != PURE_OK) { fprintf(stderr, "event failed\n"); return 1; } uint64_t work = app.work; if (app.values[0].num != 1 || !valid(doc, n, open)) { fprintf(stderr, "not both valid\n"); return 1; } double c_runs[7], pure_runs[7]; @@ -117,7 +117,7 @@ int main(int argc, char **argv) { c_runs[r] = (now_ns() - start) / rounds; start = now_ns(); for (int i = 0; i < rounds; ++i) - if (pure_app_message(&app, (uint32_t)check, NULL, -1, (PureSpan){doc, n}) != PURE_OK) return 1; + if (pure_app_message(&app, (uint32_t)check, (PureSpan){doc, n}) != PURE_OK) return 1; pure_runs[r] = (now_ns() - start) / rounds; } qsort(c_runs, 7, sizeof(double), by_value); -- cgit v1.2.3