Repository navigation
Backlog
Labels
reviewFound in the November 2026 sweeping code review
Description
Each is small. Ordered by likely gain. Those marked measure need a number from the Pi before the change is worth making.
- Size checks read whole course contents on every save.
LENGTH(CAST(content AS BLOB))inaccount_bytes,size_afterandlist_files(src/courses.rs:1137,:1122,:1081) pulls every file through the 2 MB page cache;list_filesalso reports characters as bytes. Useoctet_length(). Measure with thevmcount inSKRONGLE_SQL_TRACE. - Course export builds a full
serde_json::Valuetree on the worker (src/routes/courses/files.rs:173-184). The files are already JSON text: write them into the envelope verbatim, insideoff_worker. - Freed memory goes back to the OS only at boot.
release_boot_memory()(src/main.rs:606) callsmalloc_trim(0)once. Call it after eachoff_workerbuild and in the hourly housekeeping. MeasureVmRSSafter 30 autosaves of a 2 MB course. - A second rendered copy of every viewed lesson (
src/content.rs:663,html_content) is kept beside the sections' HTML and grows after boot. Render per view, or build the page from the sections. - Blocking threads die after 10 idle seconds, so on a quiet box each request starts and ends a thread. Try
.thread_keep_alive(300 s), or one dedicated database thread. Measure page latency on the Pi both ways;scripts/pi-budget.sh:211-213relies on the current behaviour. - The start-up dummy hash (
src/main.rs:516) could be a constant string: one hash and 8 MiB less at boot. t()clones aStringper lookup (src/i18n.rs:318) andjs_json()copies the cached text (:388). The languages live for the whole run: return&'static strand theArc.- SQL text is built with
format!on every call before the statement cache is consulted:session_sql()(src/auth.rs:391),src/mastery.rs:205,221,src/progress.rs:196,src/guide.rs:55. Make them constants. /lessonsbuilds a row for every lesson (src/routes/pages.rs:645-656), then shows 12. Build rows after choosing the unit and page.course_picture(src/routes/mod.rs:547-559) hashes the SVG per request for its ETag and copies the body. Compute the ETag when the store is built.- The AI client is built per call (
src/ai.rs:1217), so every lesson pays a new TLS handshake. One per job. The generator also holds a whole-course copy (before) for the entire run (src/ai/queue.rs:262). routes/manage/progress.rs:102-109runs three queries per opened course in a loop. One grouped query.docs/course-format.md(48 KB) is in the binary twice (src/ai.rs:51and the docs embed), andi18n/README.mdand the test course'sAUTHORING.mdare embedded and never used.- No vacuum. The file never shrinks after MB-sized courses are deleted. It only matters with the Undo copies.
Left as they are, on purpose: no compression of HTML or JSON (one slow worker, usually a LAN).
From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).
Metadata
Metadata
Assignees
Labels
reviewFound in the November 2026 sweeping code review
Activity