From 83c3f20a005086a9433ddd772c884c65b07b7187 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 5 Oct 2026 09:52:54 +0100 Subject: Pack a stored keyed list searched often into arrays and a bucket index fitted to the keys searched, between events, and build trees from the leaves up: BFS core 89 to 55 ms (022) --- core/module.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/module.c') diff --git a/core/module.c b/core/module.c index 8771cab..a01a411 100644 --- a/core/module.c +++ b/core/module.c @@ -2172,9 +2172,8 @@ static PureResult fold_runs(const PureModule *m, PureValue *values, PureBlock in /* The positions of the items whose keys are from low up to before high. */ /* The items whose keys are from low up to before high (numbers or i64s, as the key is). */ static void slice_of(const PureList *list, unsigned key, Slot low, Slot high, size_t *from, size_t *to) { - bool found; - *from = pure_list_seek(list, key, (PureCell){.i64 = low.i64}, &found); - *to = pure_list_seek(list, key, (PureCell){.i64 = high.i64}, &found); + *from = pure_list_bound(list, key, (PureCell){.i64 = low.i64}); + *to = pure_list_bound(list, key, (PureCell){.i64 = high.i64}); if (*to < *from) *to = *from; } @@ -3518,6 +3517,10 @@ static PureResult dispatch(PureApp *app, uint32_t event, Event *ev) { return result; } clear_rows(app); + /* No run of a list is open between events: one searched often since it + * last changed is packed now (docs/design/022). */ + for (uint32_t i = 0; i < m->states; ++i) + if (app->lists[i]) (void)pure_list_settle(app->lists[i]); memcpy(app->values, pending, sizeof(pending)); ++app->events; ++app->changes; -- cgit v1.2.3