diff options
| author | eunhhu <[email protected]> | 2026-09-28 00:48:27 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 00:48:27 +0100 |
| commit | ba3aaed37c9177cf7ef5f370dd6b8a616b045af9 (patch) | |
| tree | 39e77a377c24cb768e569327ba2792615e995df8 /prototypes/workbench/presentation.test.mjs | |
| parent | efb3abdf688f75f2d9436b63813cdbd9814cc285 (diff) | |
| download | pure-ba3aaed37c9177cf7ef5f370dd6b8a616b045af9.tar.gz pure-ba3aaed37c9177cf7ef5f370dd6b8a616b045af9.zip | |
Answer a fold in a column from one pass over its list
A fold in a table's column runs once per row, over its whole list each
time: per branch, the sum of its accounts read all 100,000 accounts for
every branch, and per rich account, how many are richer read them all for
each of 404 accounts. At load, a planned fold in a column whose test
compares a field of its item with a key the row gives, the rest of it
reading only its list, its item and constants, gets a shape: a group (the
field equals the key) or a rank (a count of items whose field orders
against the key, and nothing else). The app then keeps one pass over the
list per fold and list version: a group pass runs the block a leaf at a
time with the comparison taken as true and the key left out, folding each
item into its field's group; a rank pass radix-sorts the field's values.
A row runs its key alone and looks it up. The pass is made at the second
row that asks, so a fold asked once scans once.
Answers are the fold's own: items join their group in order, so a sum
adds as it would; a key that faults leaves that row to run the fold as
written, and an item that would fault in the pass leaves every row to.
lane_folds now also makes shaped folds (185 groups, 127 ranks, 98 passes
made) and checks them against the same module run item by item.
On the bank of 100,000 accounts: per-branch totals 4.8 ms (16 ms before,
SQLite 46 ms, 14 ms with the index a DBA would add on branch and balance)
and each rich account's rank 6.7 ms (268 ms before, SQLite 2.84 s, 7.6 ms
with an index on balance), HTTP and JSON included on Pure's side. Pure is
given no index.
Diffstat (limited to 'prototypes/workbench/presentation.test.mjs')
0 files changed, 0 insertions, 0 deletions
