Skip to content

Performance

gsx streams rendered HTML directly to an io.Writer. These figures describe specific workloads, not a universal renderer ranking.

Reproduce the snapshot

The current snapshot was recorded on 2026-08-17 from gsx-bench commit 26b68db36773cc0f5f336f51d5f30388220b3f98, paired with gsx commit cb5ec7c2b477a0fa6c6690eead3f815dd923ce64. Both worktrees were clean and the benchmark module resolved its local github.com/gsxhq/gsx dependency to that exact sibling core checkout.

sh
git clone https://github.com/gsxhq/gsx
git clone https://github.com/gsxhq/gsx-bench
git -C gsx checkout cb5ec7c2b477a0fa6c6690eead3f815dd923ce64
git -C gsx-bench checkout 26b68db36773cc0f5f336f51d5f30388220b3f98
cd gsx-bench
GOMAXPROCS=32 go test -run '^$' -bench . -benchmem -count=10 . > results.txt
go run golang.org/x/perf/cmd/benchstat@v0.0.0-20260709024250-82a0b07e230d results.txt

Snapshot environment: Apple M3 Ultra (darwin/arm64), Go 1.26.1, GOMAXPROCS=32, and templ v0.3.1020. Values below are ten-sample benchstat medians. The destination is a warm pooled bytes.Buffer, matching a buffered HTTP handler.

Small template

Document renders a small static/dynamic document.

enginetimebytesallocations
gsx275.5 ns ±1%56 B2
templ423.8 ns ±7%362 B10
html/template1.457 us ±2%643 B24

Component composition

Table renders 20 rows, each through a Card child component. A same-package child renders straight into the parent's writer, so the loop costs one allocation in total.

enginetimebytesallocations
gsx1.834 us ±1%32 B1
templ5.235 us ±1%4,816 B183

Component-heavy page

Page renders a full document with 20 rows of nested components, a dynamic URL per row, and utility classes on every component root.

enginetimebytesallocations
gsx4.368 us ±1%634 B42
templ7.098 us ±2%4,978 B204

Escaping-heavy content

Comments renders 20 hostile text strings through the HTML escaper.

enginetimebytesallocations
gsx3.788 us ±1%32 B1
templ7.237 us ±1%9,096 B143

These figures are machine-, version-, destination-, and workload-specific. Run the suite on your own templates and deployment hardware before making performance decisions.