oficina / docs Public

Say what a cold thumbnail render actually costs

The budget comment asserted 40 was a reasonable bound without a number
behind it. Measured on the seeded documents: a miss is ~1.9ms, so 36
documents render cold in 68ms and warm in 3.4ms, and the bound puts a
cold landing page at roughly 75ms of layout — paid only after a
restart.

Recorded with the date, the machine and what would move it, because a
bare number ages into a wrong fact.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JM96sbqzZLJgqYmAs4j5y
Paul Campbell pushed by paul@keymail.dev 2f7e80c5f9ffda19b03c9cbba230625f9f7fae2a parent f12967c
1 file changed, +10 −0
  • internal/docs/preview.go +10 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>b59vpf1mm</task-id> <tool-use-id>toolu_01StrSLqrXfpZ6wzzFMnVF7t</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-oficina-docs/e1e74ec8-0576-474e-8564-a71365101816/tasks/b59vpf1mm.output</output-file> <status>completed</status> <summary>Background command "Wait for remote CI to settle" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 16.0 g CO₂e (1985555 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on list-thumbnails, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/docs/preview.go b/internal/docs/preview.go
index 23b8823..597d415 100644
--- a/internal/docs/preview.go
+++ b/internal/docs/preview.go
@@ -221,6 +221,16 @@ func (h *handlers) thumbnail(ctx context.Context, doc *Document) []previewBar {
// is written. With one, a cold cache costs a bounded amount and warms
// over the next few renders; a warm cache never reaches the bound at
// all, because a hit does not spend from it.
+//
+// Measured rather than guessed, on the seeded sample documents
+// (2026-09-02, this machine): a miss is about 1.9ms — replay through
+// the snapshot and its tail, then one page of layout — and a hit is
+// far under that. 36 documents rendered cold in 68ms and warm in
+// 3.4ms. So this bound puts a cold landing page at roughly 75ms of
+// layout, which is a page load rather than a stall, and it is only
+// ever paid after a restart. Re-measure before raising it; the number
+// that matters is the miss, and it grows with a document's update log
+// between snapshots.
const thumbnailBudget = 40
// thumbnailer returns the function the row builders call for each