Server-side rendering of the same model the json family serialises.
Comparable across template engines rather than across frameworks. Rendering is partly the engine's work, so a ranking that carried these rows would be measuring one engine against another.
| test | heft | request | base | what differs from the base |
|---|---|---|---|---|
| template.large | 5 | GET /template/large | json.large | a template rendered instead of the model serialized |
| template.medium | 3 | GET /template/medium | json.medium | a template rendered instead of the model serialized |
| template.small | 2 | GET /template/small | json.small | a template rendered instead of the model serialized |
All 1,425 rows of items.large through the same template. Read against template.medium, the difference is the engine's per-row cost at scale, and against json.large it is rendering against serialising at one size.
GET /template/large
No body.
HTTP 200
/html/payload items.large as a page
<!doctype html><html><head><title>items</title></head><body><h1>large</h1><table><thead><tr><th>id</th><th>name</th><th>category</th><th>price</th><th>stock</th></tr></thead><tbody><tr><td>1</td><td>slate-lamp-6647</td><td>tools</td><td>18928</td><td>yes</td></tr><tr><td>2</td><td>brass-hinge-5716</td><td>garden</td><td>17577</td><td>yes</td></tr><tr><td>3</td><td>linen-ring-6971</td><td>kitchen</td><td>5540</td><td>yes</td></tr><tr><td>4</td><td>copper-bolt-9217</td><td>outdoor</td><td>11562</td><td>yes</td></tr><tr><td>5</td><td>linen-lamp-8288</td><td>office</td><td>1413</td><td>yes</td></tr><tr><td>6</td><td>copper-pan-9308</td><td>tools</td><td>10795</td><td>yes</td></tr><tr><td>7</td>< … 122,576 bytes total
Compared with whitespace at element boundaries removed and every other run of whitespace collapsed to one space.
import { performanceTest } from "#kit";
import { pages } from "#payloads";
const path = "/template/large";
export default performanceTest({
id: { family: "template", name: "large" },
path,
base: "json.large",
varies: "renderer",
heft: 5,
about:
"All 1,425 rows of items.large through the same template. Read against " +
"template.medium, the difference is the engine's per-row cost at scale, " +
"and against json.large it is rendering against serialising at one size.",
request: (c) => c.get(path).okWith(pages.large).hasHeader("content-type", /html/),
});
Eighty-nine rows through the same template. Read against template.small, the difference is the engine's per-row cost, and against json.medium it is rendering against serialising at one size.
GET /template/medium
No body.
HTTP 200
/html/payload items.medium as a page
<!doctype html><html><head><title>items</title></head><body><h1>medium</h1><table><thead><tr><th>id</th><th>name</th><th>category</th><th>price</th><th>stock</th></tr></thead><tbody><tr><td>1</td><td>slate-lamp-6647</td><td>tools</td><td>18928</td><td>yes</td></tr><tr><td>2</td><td>brass-hinge-5716</td><td>garden</td><td>17577</td><td>yes</td></tr><tr><td>3</td><td>linen-ring-6971</td><td>kitchen</td><td>5540</td><td>yes</td></tr><tr><td>4</td><td>copper-bolt-9217</td><td>outdoor</td><td>11562</td><td>yes</td></tr><tr><td>5</td><td>linen-lamp-8288</td><td>office</td><td>1413</td><td>yes</td></tr><tr><td>6</td><td>copper-pan-9308</td><td>tools</td><td>10795</td><td>yes</td></tr><tr><td>7</td> … 7,755 bytes total
Compared with whitespace at element boundaries removed and every other run of whitespace collapsed to one space.
import { performanceTest } from "#kit";
import { pages } from "#payloads";
const path = "/template/medium";
export default performanceTest({
id: { family: "template", name: "medium" },
path,
base: "json.medium",
varies: "renderer",
heft: 3,
about:
"Eighty-nine rows through the same template. Read against template.small, " +
"the difference is the engine's per-row cost, and against json.medium it " +
"is rendering against serialising at one size.",
request: (c) => c.get(path).okWith(pages.medium).hasHeader("content-type", /html/),
});
One row rendered through the framework's own view layer instead of serialised. Read against json.small, the difference is the engine, which is why this family is comparable across engines and not across frameworks.
GET /template/small
No body.
HTTP 200
/html/payload items.small as a page
<!doctype html><html><head><title>items</title></head><body><h1>small</h1><table><thead><tr><th>id</th><th>name</th><th>category</th><th>price</th><th>stock</th></tr></thead><tbody><tr><td>1</td><td>slate-lamp-6647</td><td>tools</td><td>18928</td><td>yes</td></tr></tbody></table><p>1 rows</p></body></html>
Compared with whitespace at element boundaries removed and every other run of whitespace collapsed to one space.
import { performanceTest } from "#kit";
import { pages } from "#payloads";
const path = "/template/small";
export default performanceTest({
id: { family: "template", name: "small" },
path,
base: "json.small",
varies: "renderer",
heft: 2,
about:
"One row rendered through the framework's own view layer instead of " +
"serialised. Read against json.small, the difference is the engine, which " +
"is why this family is comparable across engines and not across " +
"frameworks.",
request: (c) => c.get(path).okWith(pages.small).hasHeader("content-type", /html/),
});