aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 06:54:21 +0100
committereunhhu <[email protected]>2026-10-05 06:54:21 +0100
commit07791a8b9f9c25e83ef849e1cea431ed25be7553 (patch)
treef6bd1fa52ce5f3dec163a8df5ff43d62372480a0 /core/module.h
parentce4be172725d0aca0aa55409d4077bf788374dde (diff)
downloadpure-07791a8b9f9c25e83ef849e1cea431ed25be7553.tar.gz
pure-07791a8b9f9c25e83ef849e1cea431ed25be7553.zip
Keep an event's lists in arrays, flat or at their keys, and read a field by key as one (021)
- pure_list_arrays: an event's list (never shared, journaled or undone) keeps its items in arrays: FLAT in order, or DENSE at their keys when keyed by small whole numbers. A position asked of a DENSE list makes it FLAT; moves past a few times its items, arrays past 64 MiB, or a third change of form make it a tree. Answers are the tree's; the stored bytes stand for its items in the memory budget whatever it keeps them in. - pure_list_add need not say where an item went: a list no index state refers to is not asked. - A LIST_FIND whose index the next ITEM_GET of its list takes at once is joined to it at load (PLAN_JOINED): pure_list_lookup reads the field by key, at the key in a DENSE list. - test-module arrays_equivalence: beside a tree, every step of a random run (adds, inserts, removes, changes, finds, reads, runs, clears) gives the same answers through every form and change of form. - A search (100,000 nodes, 1,000,000 edges, core only): 187 to 126 ms.
Diffstat (limited to 'core/module.h')
-rw-r--r--core/module.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/module.h b/core/module.h
index 80d4460..9562358 100644
--- a/core/module.h
+++ b/core/module.h
@@ -254,6 +254,7 @@ typedef struct {
/* A keyed list: its key field + 1 (0: none). Its items stay in key order
* (numbers by value, texts by bytes), each key once, and keys do not change. */
uint8_t state_key[PURE_MODULE_STATES];
+ bool state_indexed[PURE_MODULE_STATES]; /* list: an index state refers to it (set at load) */
PureInputShape input[PURE_MODULE_INPUTS];
PureField field[PURE_MODULE_FIELDS];
PureValue initial[PURE_MODULE_STATES];