From 4bedd7f03eb18fd79492c905d142b9bcf1acf242 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 5 Oct 2026 18:47:57 +0100 Subject: A text-keyed list let go at an event's end starts no key set (a number's bits): one that an index state then asks where an item went is inserted FLAT, whose key set an item's layout key (-1) would read past; the FLAT and tree key sets kept only for number keys. A list read by position checks for HASHED where it is not a tree alone (stored lists: none of it): the bank queries' instructions within 0.5% of 6b45806 (0.3-0.8% before) text_keys_equivalence asks where an item went in some events --- core/test-module.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core/test-module.c') diff --git a/core/test-module.c b/core/test-module.c index 371fca5..42f01af 100644 --- a/core/test-module.c +++ b/core/test-module.c @@ -1404,9 +1404,11 @@ static double some_number(unsigned event, uint32_t r) { } } -/* An item into a list keyed by its text field 0, as the executor does: added at once (HASHED), else found and inserted. */ -static PureResult text_add(PureList *list, const PureCell *cells, bool *exists) { - PureResult result = pure_list_add(list, cells, NULL, NULL, exists); +/* An item into a list keyed by its text field 0, as the executor does: added at once (HASHED; not when where it went is + * asked, as an index state asks), else found and inserted. */ +static PureResult text_add(PureList *list, const PureCell *cells, bool ask, bool *exists) { + size_t where; + PureResult result = pure_list_add(list, cells, NULL, ask ? &where : NULL, exists); if (result != PURE_INVALID) return result; size_t at = pure_list_seek(list, 0, cells[0], exists); return *exists ? PURE_OK : pure_list_insert(list, at, cells, NULL); @@ -1434,7 +1436,7 @@ static void text_keys_equivalence(void) { unsigned op = next_random(&seed) % (event % 4 == 1 ? 10 : 16); /* some events by key alone: HASHED stays */ if (op < 5) { bool ea, et; - CHECK(text_add(a, cells, &ea) == PURE_OK && text_add(t, cells, &et) == PURE_OK && ea == et); + CHECK(text_add(a, cells, event % 3 == 2 && r % 31 == 0, &ea) == PURE_OK && text_add(t, cells, false, &et) == PURE_OK && ea == et); } else if (op < 8) { /* has, and fields by key */ bool ha, ht, fa, ft; PureCell ca, ct; @@ -1483,8 +1485,8 @@ static void text_keys_equivalence(void) { } pure_list_free(a); pure_list_free(t); - CHECK(hashed > 10000); printf("{\"text_keys\":{\"steps\":%zu,\"hashed\":%zu}}\n", steps, hashed); + CHECK(hashed > 8000); } static void arrays_equivalence(void) { -- cgit v1.2.3