From f7d369e77d999a0e60f3de2b5511b99c81b266bb Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 5 Oct 2026 17:24:28 +0100 Subject: HASHED (023): an event's list keyed by numbers that came out of order keeps each item's cells at its key's slot in its members' table, found by key there (the key and its cells read at one slot, as C's table); its order made by a radix sort of the slots' keys when something asks for a position (twice an event, then FLAT or a tree). The tier finds by key alone in a HASHED list (its bits' bit 1, its limit all ones: the bounds checked at a loop's opening still hold) out of the line; a list keyed by each count in order is DENSE from its first item. join 531 to 108 ms (3.5x C), sort 98 to 58 (2.1x) arrays_equivalence counts the HASHED form against a tree; module_tier's programs read a HASHED list by key --- core/test-module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/test-module.c') diff --git a/core/test-module.c b/core/test-module.c index f6283fe..3fc0985 100644 --- a/core/test-module.c +++ b/core/test-module.c @@ -1407,7 +1407,7 @@ static double some_number(unsigned event, uint32_t r) { static void arrays_equivalence(void) { static const uint8_t fields[3] = {PURE_CELL_NUMBER, PURE_CELL_TEXT, PURE_CELL_NUMBER}; uint32_t seed = 0x61727261u; - size_t forms[3] = {0}, conversions = 0, steps = 0; + size_t forms[4] = {0}, conversions = 0, steps = 0; for (unsigned keyed = 0; keyed < 2; ++keyed) { PureList *a = pure_list_new(3, fields), *t = pure_list_new(3, fields); CHECK(a && t); @@ -1507,7 +1507,7 @@ static void arrays_equivalence(void) { pure_list_free(a); pure_list_free(t); } - CHECK(forms[0] > 10000 && forms[1] > 10000 && forms[2] > 10000 && conversions > 100); + CHECK(forms[0] > 10000 && forms[1] > 10000 && forms[2] > 10000 && forms[3] > 10000 && conversions > 100); /* A snapshot shares every list: an event's, empty between events, stays in arrays; one with items is a tree for its copy. */ { PureList *list = pure_list_new(3, fields); @@ -1526,8 +1526,8 @@ static void arrays_equivalence(void) { pure_list_free(list); pure_retired_free(&retired); } - printf("{\"arrays\":{\"steps\":%zu,\"tree\":%zu,\"flat\":%zu,\"dense\":%zu,\"conversions\":%zu}}\n", steps, forms[0], forms[1], - forms[2], conversions); + printf("{\"arrays\":{\"steps\":%zu,\"tree\":%zu,\"flat\":%zu,\"dense\":%zu,\"hashed\":%zu,\"conversions\":%zu}}\n", steps, + forms[0], forms[1], forms[2], forms[3], conversions); } /* The first position in a model (in key order) whose key is not below key. */ -- cgit v1.2.3