Overview
| Artifact ID: | 3d210fc96a2bffe65bca41df38ec3b6defcf84429382c5423bfd0c238fb7dacf |
|---|---|
| Ticket: | 61417e834bebf399d0d2f0a7961da35bcf7563da
Evaluated valyala/quicktemplate as an html/template replacement — not adopting |
| User & Date: | ai-local on 2026-08-31 11:54:08 |
Changes
- Untracked field cmimetype: "text/x-markdown"
- comment changed to:
Asked to look at quicktemplate, which advertises a 20x speedup over html/template. Measured first, and it does not apply to quarry. WHAT THE BENCHMARK MEASURES: 120ns/op vs html/template 2501ns/op on one simple template. A per-execution microbenchmark, not a page. WHY IT DOES NOT HELP HERE. The decisive number: /api/v1/r/sqlite/file/trunk/src/btree.c — which never touches html/template — takes 703ms TTFB, SLOWER than the 461ms HTML page for the same file. The cost is blob retrieval and highlighting, not templating. Corroborating: the timeline page emits 309,584 bytes of HTML in 12ms total including ops, so template execution is bounded well under that; scaled linearly, the 2.3MB btree.c page is maybe ~90ms of template inside 461ms. A 20x cut there returns ~19% on one page type and nothing on ordinary pages. Amdahl. WHAT IT WOULD COST. (1) Escaping: quicktemplate escapes explicitly per tag ({%s%}, {%q%}, {%u%}) — it is NOT contextual. html/template knows whether it is in an attribute, URL, JS or CSS context and escapes accordingly. quarry renders untrusted upstream content — commit messages, ticket titles and forum posts from mirrored fossil repos — so contextual auto-escaping is a security property, and swapping it for per-call discipline across a 20k-line template surface trades a class of XSS bug for percentage points. (2) A qtc codegen step and .qtpl files, where templates are currently Go constants compiled into the binary. (3) A dependency, against the smol contract. DECISION: no. The measured bottlenecks are highlighting and blob retrieval — see the highlight cache and file-windowing tickets. Revisit only if a profile ever shows template execution dominating, which today it does not. - priority changed to: "Low"
- severity changed to: "Minor"
- status changed to: "Closed"
- subsystem changed to: "web"
- title changed to:
Evaluated valyala/quicktemplate as an html/template replacement — not adopting
- type changed to: "Feature"