aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 09:40:16 +0100
committereunhhu <[email protected]>2026-09-28 09:40:16 +0100
commitcdeee266d3d0f22cd245c6febf69e71a00b1adb6 (patch)
tree3fbe630e34db9f721e8a93ba0ea2126383594768 /core/module.c
parenta8232abe41cc168fb1596eb16047133fddd7a9ad (diff)
downloadpure-cdeee266d3d0f22cd245c6febf69e71a00b1adb6.tar.gz
pure-cdeee266d3d0f22cd245c6febf69e71a00b1adb6.zip
Guide a list's inner nodes: items before each child and its first key, searched without branches
Diffstat (limited to 'core/module.c')
-rw-r--r--core/module.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/module.c b/core/module.c
index 8d889f7..efa3b1d 100644
--- a/core/module.c
+++ b/core/module.c
@@ -3342,8 +3342,12 @@ PURE_COLD static PureResult open_module(PureApp *app, const PureModule *module)
memcpy(app->list_drafts, list_drafts, sizeof(list_drafts));
memcpy(app->journaled, journaled, sizeof(journaled));
memcpy(app->saved, saved, sizeof(saved));
- for (uint32_t i = 0; i < module->states; ++i)
+ for (uint32_t i = 0; i < module->states; ++i) {
if (list_drafts[i]) pure_list_journal(lists[i], true); /* a stored list's changes are recorded from now on */
+ /* Without memory for its keys a keyed list is still searched, only slower. */
+ if (module->state_type[i] == PURE_STATE_LIST)
+ (void)pure_list_keyed(lists[i], module->state_key[i] ? (int)module->state_key[i] - 1 : -1);
+ }
if (old) remap_outputs(app, old, module, true);
drop_passes(app); /* kept by instruction of the module they were made for */
app->module = module;