diff options
| author | eunhhu <[email protected]> | 2026-10-05 09:52:54 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-05 09:52:54 +0100 |
| commit | 83c3f20a005086a9433ddd772c884c65b07b7187 (patch) | |
| tree | e0ebcdb1578bce1f100d4ab74ca80b3b445d0351 /core/module.c | |
| parent | 58b8d5b291422a0c12db590eefbad6efe96cc6de (diff) | |
| download | pure-83c3f20a005086a9433ddd772c884c65b07b7187.tar.gz pure-83c3f20a005086a9433ddd772c884c65b07b7187.zip | |
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)
Diffstat (limited to 'core/module.c')
| -rw-r--r-- | core/module.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |
