You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some Storage and Runtime Host operations process substantially more data than the requested result or the new change requires. Repeated page serialization, full-record output updates, full-store metadata reads, and historical Usage materialization can spend CPU, memory, and I/O on unchanged or unrelated data.
This tracker owns the remaining delivery and measurement work identified by Discussion #4876. It is scoped to read/write amplification in Storage and the Host protocol, rather than every performance issue in Maka.
Scope and relationship to existing work
This tracker: rows scanned/materialized/decoded, bytes encoded and written, and how those costs scale with the requested page, changed data, and stored history.
Use existing issues and PRs for their concrete work. Links here record dependencies and acceptance; they do not create a second implementation or a second owner.
Current evidence
Source inspection baseline: 87797378c. The observations below are code-path evidence, not new production latency measurements.
Repeated encoding and page assembly
Several page builders append one item, serialize the entire candidate page, and discard that encoding after checking its byte length. Examples:
For similarly sized items, cumulative serialization work grows quadratically with the number of items admitted to a page. Existing count/byte caps limit several of these paths; this is not a claim of unbounded whole-history work or a measured user-visible regression in every page builder.
Byte-limit helpers also retain private copies alongside protocol/codec.ts. Consolidation alone is not performance acceptance: measure actual repeated serialization along producer/consumer paths. The transport already accepts EncodedProtocolMessage; extend that seam where applicable rather than adding a parallel encoding path. Raw frame bytes, normalized values, and nested-object budgets are distinct and must not be substituted for one another.
Shell output persistence
ShellRunManager.queuePersist compares the output snapshot with the current record and calls updateShellRun. Storage reads the stored record and serializes the complete next record into record_json.
The full-record operation is confirmed. Its practical amplification remains to be measured against retained-output bounds, flush frequency, and SQLite write/WAL bytes before selecting a representation change.
Verify bounded materialization when unrelated Sessions grow and when the target Session grows; preserve revision consistency and cross-process visibility.
#5023 is currently a design-only draft. Resolve its Storage/query boundaries, then measure SQL scan/sort work as well as application decoding and transfer. UI pagination alone is insufficient.
Delivery checklist
Deliver the first encoding/page-assembly change through existing protocol seams. Record the concrete covered paths, remove replaced implementations in the same change, and attach same-load before/after evidence. Keep this as one PR unless an actual dependency blocks part of the work.
Measure Shell output persistence at representative retained-output sizes and flush rates. Record either a justified follow-up with its recovery contract or an explicit decision that the bounded cost is acceptable.
Usage retention after Session deletion is a product-policy decision, not permission to delete historical records as part of a performance fix.
Other tables without retirement paths are not automatically implementation tasks. Add work only when growth or an operational obligation is established.
A repository-wide CI ratchet or mandatory exception ledger is not a prerequisite for the first fix and is not approved by this tracker.
Acceptance
For each delivered path:
Name the real producer, authority, and downstream consumer. Measure through that path rather than only benchmarking a helper.
Compare the same workload on explicit before/after commits. Vary the relevant dimension: page size, target history, unrelated records, retained output, or retired Session count. Include a cold/warm distinction where relevant.
Report applicable rows scanned/decoded, serialization work, retained memory, write/WAL bytes, and elapsed time. For timing comparisons, use repeated runs and report median/p95; distinguish synthetic measurements from production observations.
Preserve UTF-8 byte budgets, completeness/cursor semantics, revision consistency, atomic durable facts, and retry/restart behavior relevant to the changed path. Retain focused behavioral tests that fail on the replaced behavior.
Do not accept moving a full scan from reads to every write, materializing everything behind a paginated API, or adding a second durable authority as a reduction in amplification.
Completion means each delivery item has a verified result or a documented, evidence-backed scope decision. It does not mean every read is constant-time, every historical row is deleted, or the separate user-experience budgets in #4677 have been met.
AI assistance: Codex helped inspect current source and draft this tracker under maintainer direction.
Problem
Some Storage and Runtime Host operations process substantially more data than the requested result or the new change requires. Repeated page serialization, full-record output updates, full-store metadata reads, and historical Usage materialization can spend CPU, memory, and I/O on unchanged or unrelated data.
This tracker owns the remaining delivery and measurement work identified by Discussion #4876. It is scoped to read/write amplification in Storage and the Host protocol, rather than every performance issue in Maka.
Scope and relationship to existing work
Use existing issues and PRs for their concrete work. Links here record dependencies and acceptance; they do not create a second implementation or a second owner.
Current evidence
Source inspection baseline:
87797378c. The observations below are code-path evidence, not new production latency measurements.Repeated encoding and page assembly
Several page builders append one item, serialize the entire candidate page, and discard that encoding after checking its byte length. Examples:
For similarly sized items, cumulative serialization work grows quadratically with the number of items admitted to a page. Existing count/byte caps limit several of these paths; this is not a claim of unbounded whole-history work or a measured user-visible regression in every page builder.
Byte-limit helpers also retain private copies alongside
protocol/codec.ts. Consolidation alone is not performance acceptance: measure actual repeated serialization along producer/consumer paths. The transport already acceptsEncodedProtocolMessage; extend that seam where applicable rather than adding a parallel encoding path. Raw frame bytes, normalized values, and nested-object budgets are distinct and must not be substituted for one another.Shell output persistence
ShellRunManager.queuePersist compares the output snapshot with the current record and calls
updateShellRun. Storage reads the stored record and serializes the complete next record intorecord_json.The full-record operation is confirmed. Its practical amplification remains to be measured against retained-output bounds, flush frequency, and SQLite write/WAL bytes before selecting a representation change.
Existing delivery paths
Delivery checklist
Already changed; do not reopen from the old inventory
Deferred questions
Acceptance
For each delivered path:
Completion means each delivery item has a verified result or a documented, evidence-backed scope decision. It does not mean every read is constant-time, every historical row is deleted, or the separate user-experience budgets in #4677 have been met.
AI assistance: Codex helped inspect current source and draft this tracker under maintainer direction.