aboutsummaryrefslogtreecommitdiffstats
path: root/docs/research/034-hybrid-document-storage.md
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-27 23:38:54 +0100
committereunhhu <[email protected]>2026-09-27 23:38:54 +0100
commit72f8e1ca1fba181eeed6d2643a21f05881272d83 (patch)
tree5be9ab7140ecb851e7e2150a28ef8e2d0607e406 /docs/research/034-hybrid-document-storage.md
parentbac70f376ef539a03a25e187f706fe8f9f67f01e (diff)
downloadpure-72f8e1ca1fba181eeed6d2643a21f05881272d83.tar.gz
pure-72f8e1ca1fba181eeed6d2643a21f05881272d83.zip
Keep a list's items in a persistent tree
A list was one array of item pointers: an item's place in the stored form was found by adding up the sizes of every item before it, so each change and each appended row cost O(n); a snapshot copied a changed list's whole array at each save; and a list held at most 65,536 items. A bank of 30,000 accounts ran transfers at 299 us of CPU each, and set up in time growing with the square of its rows. Items now live in a B+tree of fanout 32 whose nodes know the items below them, their stored bytes and the first of them: positions, keys (keyed lists) and stored offsets are found in O(log n). Nodes carry the list's share count when made, as items do: one a snapshot may read never changes, so a change copies the path to it and retires the nodes it replaced, and a share is a root and a count. Reads in order go through a finger, each thread's last leaf. A list may hold 2^24 items. list_trees checks it against a model array: 6,000 events of inserts, removals and field changes, 1,195 of them undone, up to 8,983 items (three levels), the stored form equal byte for byte, four shares kept whole while the list changes on, and 13,959 keyed items found by key as a binary search finds them. The app model's tests pass under ASan and UBSan too.
Diffstat (limited to 'docs/research/034-hybrid-document-storage.md')
0 files changed, 0 insertions, 0 deletions