From 6a28879bd56354483fe940c0c80d511eccb89983 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Fri, 25 Sep 2026 09:33:43 +0100 Subject: Add selected single-file persistent tree store store-tree.c keeps every document in one append-only file as a persistent B-tree of byte extents, with the key catalog in the same structure. A splice writes only the changed leaf and path; unchanged extents are shared between versions, readers take no lock, and two alternating head slots publish a commit after its nodes are durable. Compaction rewrites reachable nodes. On the recorded ext4 host a durable 1-byte middle insert into a 1 MiB document took 8.58 ms against 78.51 ms for the default store, and the real TUI's Ctrl+S after typing took 16.60 ms against 84.59 ms. check-tree runs the store's crash/oracle tests and the unchanged runtime, splice, async and real-PTY editor checks on it. It stays opt-in: linked code is 12.7 KB larger and contiguous multi-leaf reads copy. --- .../2026-09-25-tui-ext4-linux-aarch64.json | 285 +++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 research/experiments/008-tree-store-edit-cost/2026-09-25-tui-ext4-linux-aarch64.json (limited to 'research/experiments/008-tree-store-edit-cost/2026-09-25-tui-ext4-linux-aarch64.json') diff --git a/research/experiments/008-tree-store-edit-cost/2026-09-25-tui-ext4-linux-aarch64.json b/research/experiments/008-tree-store-edit-cost/2026-09-25-tui-ext4-linux-aarch64.json new file mode 100644 index 0000000..6bea961 --- /dev/null +++ b/research/experiments/008-tree-store-edit-cost/2026-09-25-tui-ext4-linux-aarch64.json @@ -0,0 +1,285 @@ +{ + "platform": "Linux-6.18.39+rpt-rpi-2712-aarch64-with-glibc2.41", + "filesystem": "/dev/mmcblk0p2 ext4", + "document_bytes": 1048576, + "rounds": 3, + "edits_per_session": 8, + "median_ms": { + "replace": { + "flat": 86.32, + "paged": 21.31, + "tree": 16.97 + }, + "append": { + "flat": 84.59, + "paged": 93.29, + "tree": 16.6 + } + }, + "binaries": { + "flat": { + "cli_sha256": "f69c7580104b873e0736d7503dcbbcbb6b180adf54920e6ba741d363262867b8", + "tui_sha256": "644980089e65e9db01ecdd21c4edf8a0ae7fe248114340b3b691e6c283e5e5b4" + }, + "paged": { + "cli_sha256": "233311ee133bc1d5299963f4523131dac542d71013cb825f8a4eaa48de813ee8", + "tui_sha256": "77169c79a800881e901e5b1bba938543eed5f3f1f0914799e56c0635859af2d1" + }, + "tree": { + "cli_sha256": "c0c783a1b30a1f8e88bfe9a09b6ae124f596bf6239b802e4aec5e56f374714b9", + "tui_sha256": "8030475c663b09791a5fa24bad2f8498f652d4361a6734a737b3c6a22e4659aa" + } + }, + "runs": { + "replace": { + "flat": [ + { + "samples_ns": [ + 83883854, + 32709073, + 121001564, + 92289945, + 96340473, + 90943269, + 47708564, + 89206225 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 85403197, + 33045701, + 71709920, + 88249419, + 87284740, + 30588422, + 86124025, + 86515579 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 85907991, + 52699698, + 36407605, + 91580804, + 91115363, + 96859361, + 91057308, + 30358535 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + } + ], + "paged": [ + { + "samples_ns": [ + 21286170, + 21523669, + 20435102, + 21175041, + 24219650, + 19863957, + 21457280, + 20223807 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 20820044, + 18812854, + 22029072, + 19884550, + 21458169, + 21256596, + 25127069, + 73009317 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 21277781, + 23763283, + 18573541, + 21452318, + 21336634, + 75828726, + 18893984, + 21467613 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + } + ], + "tree": [ + { + "samples_ns": [ + 16691108, + 17111328, + 15930836, + 17254197, + 16401425, + 16596591, + 17847323, + 18489726 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 16340445, + 18211228, + 12615914, + 17297716, + 17568492, + 16601387, + 17259642, + 15886466 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + }, + { + "samples_ns": [ + 17321808, + 16796238, + 16831978, + 15132138, + 17392253, + 12584915, + 17342679, + 17423900 + ], + "body_sha256": "1acbea9ad5e6321b7e4f8b3f85450d99cb2d82b655820160dcd18bcaae58e00f" + } + ] + }, + "append": { + "flat": [ + { + "samples_ns": [ + 85268681, + 58706620, + 80969562, + 30847551, + 88231013, + 85485051, + 29563059, + 88786509 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 58646271, + 30913440, + 89689432, + 85278758, + 33291979, + 86740285, + 83913915, + 90844368 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 51920946, + 28831473, + 85487720, + 85906421, + 85835644, + 32848520, + 85315555, + 82713850 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + } + ], + "paged": [ + { + "samples_ns": [ + 91333586, + 37920058, + 92091377, + 63703624, + 95308984, + 40485355, + 99081866, + 93075370 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 96352460, + 93512017, + 65222596, + 38763552, + 98852258, + 131612999, + 138169789, + 131450371 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 40996002, + 93012356, + 63056206, + 93559778, + 37065306, + 98450597, + 112059339, + 111368899 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + } + ], + "tree": [ + { + "samples_ns": [ + 15267508, + 17113014, + 17454104, + 16570055, + 69532029, + 15171139, + 18091600, + 11101536 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 19964902, + 14639290, + 16407186, + 17425161, + 15285638, + 18012231, + 15061398, + 17329272 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + }, + { + "samples_ns": [ + 17466771, + 16352390, + 16629406, + 15132064, + 18861503, + 11662162, + 16306335, + 17256958 + ], + "body_sha256": "bd42946a8dafa764907691fbebfd981ef4b012fbcbf5c25beab7d6b1c8d0cc30" + } + ] + } + } +} -- cgit v1.2.3