← tests

template

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.

testheftrequestbasewhat differs from the base
template.large5GET /template/largejson.largea template rendered instead of the model serialized
template.medium3GET /template/mediumjson.mediuma template rendered instead of the model serialized
template.small2GET /template/smalljson.smalla template rendered instead of the model serialized

template.large

heft 5

base json.large

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

GET /template/large

No body.

Expected response

HTTP 200
content-typematches /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.

Test source, tests/template/large.ts
tests/template/large.tsopen on GitHub →
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/),
});

template.medium

heft 3

base json.medium

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

GET /template/medium

No body.

Expected response

HTTP 200
content-typematches /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.

Test source, tests/template/medium.ts
tests/template/medium.tsopen on GitHub →
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/),
});

template.small

heft 2

base json.small

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

GET /template/small

No body.

Expected response

HTTP 200
content-typematches /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.

Test source, tests/template/small.ts
tests/template/small.tsopen on GitHub →
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/),
});