From d693cc750b75b2d862614b6f79f81a311f6294ca Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 21:54:49 +0100 Subject: Lend a text state's stored extents for its view (079) A view that shows a text state as it is (pure_module_text_state) now goes out as the state's stored extents, as a document read does: the answer holds the store mapping, charged to the budget, until it is sent and its ticket released; a state with edits not yet stored is copied as before. Documents and views share one loan path, and the extent array grows as needed. A 1 MiB note read by 8 connections: 776-817 answers a second copied, 1,875-1,901 lent, p50 9.2 to 3.5 ms, peak RSS 10.3 to 5.7 MiB. The load generator learns GET /views/page. --- prototypes/connections/module.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'prototypes/connections/module.c') diff --git a/prototypes/connections/module.c b/prototypes/connections/module.c index 1b96ac1..e4c7309 100644 --- a/prototypes/connections/module.c +++ b/prototypes/connections/module.c @@ -662,6 +662,12 @@ int pure_module_position(const PureModule *m, uint32_t view) { return block->length == 2 && code[0].op == PURE_OP_INDEX_LOAD && code[1].op == PURE_OP_INDEX_NUM ? (int)code[0].arg : -1; } +int pure_module_text_state(const PureModule *m, uint32_t view) { + if (view >= m->views || m->view_type[view] != PURE_VIEW_TEXT || m->view_table[view]) return -1; + const PureBlock *block = &m->view_code[view]; + return block->length == 1 && m->code[block->start].op == PURE_OP_TEXT_LOAD ? (int)m->code[block->start].arg : -1; +} + int pure_module_column(const PureModule *m, uint32_t table, const char *name) { for (uint32_t i = 0; i < m->views; ++i) if (m->view_table[i] == table + 1 && !strcmp(m->view_names[i], name)) return (int)i; -- cgit v1.2.3