aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/040-against-c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 19:30:16 +0100
committereunhhu <[email protected]>2026-10-18 19:30:16 +0100
commitb22b8c3f6c5378b47c36370225d7c41d4394bb7c (patch)
treed1a3cbf1b0e718f0acafa08ec6741761f08e5dd5 /research/experiments/040-against-c
parente8b3499289022c8729900a58ed218d961a85fec8 (diff)
downloadpure-b22b8c3f6c5378b47c36370225d7c41d4394bb7c.tar.gz
pure-b22b8c3f6c5378b47c36370225d7c41d4394bb7c.zip
Module format v7, 027's 4b-2: keyed documents gone, a keyed list of records holding bytes doing their work: no collections table, DOC, DOC_SIZE or REPLACE (106 opcodes now 103, those from LEN on moved up), keyed messages or a base revision (pure_app_message takes an input and a payload), no PureData document callbacks (a data host opens states and saves them together), no burst by document key; the header 38 bytes; pure-edit-module gone; pure-serve without /objects, ETag, If-Match and If-None-Match, 412 or an app a thread for a module of documents alone (one without states or outputs runs so); a hole closed: an instruction in no handler's, view's or function's block was never verified yet the load's later passes read its arguments (a damaged module read out of bounds once the header moved what the mutation test damaged), now blanked to CONST 0; checks moved: server_documents (DOCS_SOURCE, keyed byte documents with the app's revision, against a Python model, one and three connection threads, a restart) in place of the parity with editor.pure, pipelining and bursts through kill -9 on its inputs and views, the lent budget on a text view (lending a document's read is server_lent_views' already), clocks and tokens on it; message tests without a document host; the HTTP benchmark's document suite runs the earlier document server and the baselines alone; the count harness builds against either message API (runs.sh build: -DPURE_KEYED_MESSAGES before 4b); counts: b33 against b32 with batches within 0.002% but BFS -0.33%, without batches BFS +0.63%, knapsack +0.52%, join +0.38%; the bank's queries (s32 on a v6 module, s33 on v7) field +0.68%, found +0.44%, large +0.42%, the rest within 0.13%; 008 as v7, 027's 4b-2 as made and 4c designed
Diffstat (limited to 'research/experiments/040-against-c')
-rw-r--r--research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl2
-rw-r--r--research/experiments/040-against-c/2026-10-18-counts-s33.jsonl2
-rw-r--r--research/experiments/040-against-c/runs.sh4
-rw-r--r--research/experiments/040-against-c/suite-run.c14
4 files changed, 18 insertions, 4 deletions
diff --git a/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl b/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl
new file mode 100644
index 0000000..cfef4f6
--- /dev/null
+++ b/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl
@@ -0,0 +1,2 @@
+{"serve": "pure-serve", "per_branch": {"instructions": 27064595, "cycles": 11936072}, "in_credit": {"instructions": 3508659, "cycles": 1627657}, "large": {"instructions": 1423198, "cycles": 625928}, "ranks": {"instructions": 24446380, "cycles": 15093091}, "none": {"instructions": 617123, "cycles": 236726}, "field": {"instructions": 9028796, "cycles": 3384389}, "found": {"instructions": 14180082, "cycles": 12075121}}
+{"serve": "pure-serve", "per_branch": {"instructions": 27033728, "cycles": 11955217}, "in_credit": {"instructions": 3501713, "cycles": 1414960}, "large": {"instructions": 1423142, "cycles": 605214}, "ranks": {"instructions": 24429139, "cycles": 14872254}, "none": {"instructions": 617115, "cycles": 192865}, "field": {"instructions": 9028788, "cycles": 3346914}, "found": {"instructions": 14179473, "cycles": 10774389}}
diff --git a/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl b/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl
new file mode 100644
index 0000000..e1ed651
--- /dev/null
+++ b/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl
@@ -0,0 +1,2 @@
+{"serve": "pure-serve", "per_branch": {"instructions": 26940620, "cycles": 11956474}, "in_credit": {"instructions": 3480396, "cycles": 1582124}, "large": {"instructions": 1429175, "cycles": 606440}, "ranks": {"instructions": 24391428, "cycles": 14777801}, "none": {"instructions": 617940, "cycles": 190815}, "field": {"instructions": 9090056, "cycles": 3297986}, "found": {"instructions": 14242161, "cycles": 11634241}}
+{"serve": "pure-serve", "per_branch": {"instructions": 27162324, "cycles": 11942429}, "in_credit": {"instructions": 3530258, "cycles": 1604696}, "large": {"instructions": 1429143, "cycles": 613979}, "ranks": {"instructions": 24513498, "cycles": 14981857}, "none": {"instructions": 617940, "cycles": 192686}, "field": {"instructions": 9090159, "cycles": 3293663}, "found": {"instructions": 14242529, "cycles": 10703067}}
diff --git a/research/experiments/040-against-c/runs.sh b/research/experiments/040-against-c/runs.sh
index a265ac0..b3e95ba 100644
--- a/research/experiments/040-against-c/runs.sh
+++ b/research/experiments/040-against-c/runs.sh
@@ -27,7 +27,9 @@ build)
git worktree add -f -q --detach "$builds/src-$2" "$3"
make -s -C "$builds/src-$2" build/libpure.a
mkdir -p "$builds/$2"
- cc -O2 -g -std=c17 -I"$builds/src-$2/core" $here/suite-run.c "$builds/src-$2/build/libpure.a" -lm -o "$builds/$2/suite-run"
+ keyed=""
+ grep -q PURE_APP_PENDING "$builds/src-$2/core/module.h" && keyed=-DPURE_KEYED_MESSAGES # before 027's 4b
+ cc -O2 -g -std=c17 $keyed -I"$builds/src-$2/core" $here/suite-run.c "$builds/src-$2/build/libpure.a" -lm -o "$builds/$2/suite-run"
git worktree remove --force "$builds/src-$2"
for work in roots knapsack sort join words matmul; do ../aup/build/aup build $here/$work.aup -o "$builds/$2/$work.pmod"; done
../aup/build/aup build research/experiments/033-computing/graph.aup -o "$builds/$2/graph.pmod" ;;
diff --git a/research/experiments/040-against-c/suite-run.c b/research/experiments/040-against-c/suite-run.c
index f8c03e7..410b9dc 100644
--- a/research/experiments/040-against-c/suite-run.c
+++ b/research/experiments/040-against-c/suite-run.c
@@ -12,6 +12,14 @@
* Without NAMEs, all of them. PURE_JIT and PURE_AHEAD as the core reads them. */
#define _POSIX_C_SOURCE 200809L
#include "module.h"
+/* A message: before 027's 4b it took a key and a base revision too (runs.sh build gives -DPURE_KEYED_MESSAGES then). */
+static PureResult send_message(PureApp *app, uint32_t input, PureSpan payload) {
+#ifdef PURE_KEYED_MESSAGES
+ return pure_app_message(app, input, NULL, -1, payload);
+#else
+ return pure_app_message(app, input, payload);
+#endif
+}
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -38,13 +46,13 @@ static bool load_graph(PureApp *app, const PureModule *m, uint32_t nodes, size_t
size_t unique = graph_build(nodes, edges, &keys);
unsigned char four[4];
memcpy(four, &nodes, 4);
- if (pure_app_message(app, (uint32_t)pure_module_input(m, "size"), NULL, -1, (PureSpan){four, 4}) != PURE_OK) return false;
+ if (send_message(app, (uint32_t)pure_module_input(m, "size"), (PureSpan){four, 4}) != PURE_OK) return false;
enum { CHUNK = 65536 };
double *rows = malloc(CHUNK * 2 * sizeof(*rows));
for (size_t at = 0; at < unique; at += CHUNK) {
size_t n = unique - at < CHUNK ? unique - at : CHUNK;
for (size_t k = 0; k < n; ++k) rows[2 * k] = (double)keys[at + k], rows[2 * k + 1] = (double)(keys[at + k] & 0xFFFFF);
- if (pure_app_message(app, (uint32_t)pure_module_input(m, "load"), NULL, -1, (PureSpan){(unsigned char *)rows, n * 16}) !=
+ if (send_message(app, (uint32_t)pure_module_input(m, "load"), (PureSpan){(unsigned char *)rows, n * 16}) !=
PURE_OK)
return false;
}
@@ -94,7 +102,7 @@ static int run(const char *dir, const Work *w, unsigned rounds) {
unsigned char bytes[8];
memcpy(bytes, args, 4 * w->argc);
double a = now_ms();
- PureResult result = pure_app_message(&app, (uint32_t)input, NULL, -1, (PureSpan){bytes, 4 * w->argc});
+ PureResult result = send_message(&app, (uint32_t)input, (PureSpan){bytes, 4 * w->argc});
double b = now_ms();
if (result != PURE_OK) { fprintf(stderr, "%s failed: %s\n", w->name, pure_fault_name(app.fault)); return 1; }
double out[4] = {0};