Router captures, with segment depth held constant, each bound as an integer and echoed.
Comparable across every framework. The static row holds the depth, so the capture rows minus it is the router capturing rather than the router matching.
A value written {run.name} is drawn once per run and never given to the framework, so it cannot answer from a table.
| test | heft | request | base | what differs from the base |
|---|---|---|---|---|
| parameters.static | 1 | GET /parameters/static/segment/literal | json.small | a deeper static route, with no captures in it |
| parameters.one | 1 | GET /parameters/{run.one}/segment/literal | parameters.static | one more path segment the router has to capture |
| parameters.two | 1 | GET /parameters/{run.one}/with-second/{run.two} | parameters.one | one more path segment the router has to capture |
| parameters.three | 1 | GET /parameters/{run.one}/{run.two}/{run.three} | parameters.two | one more path segment the router has to capture |
Four static segments and no captures. This holds the route depth constant for the two rows that capture, so subtracting it leaves the router capturing rather than the router matching a longer path.
GET /parameters/static/segment/literal
No body.
HTTP 200
payload items.small
{"size":"small","count":1,"items":[{"id":1,"name":"slate-lamp-6647","category":"tools","priceCents":18928,"inStock":true}]}Compared as parsed JSON, so key order and how a number is written do not matter.
import { performanceTest } from "#kit";
import { items } from "#payloads";
const path = "/parameters/static/segment/literal";
export default performanceTest({
id: { family: "parameters", name: "static" },
path,
base: "json.small",
varies: "depth",
heft: 1,
about:
"Four static segments and no captures. This holds the route depth " +
"constant for the two rows that capture, so subtracting it leaves the " +
"router capturing rather than the router matching a longer path.",
request: (c) => c.get(path).okWith(items.small),
});
One segment captured, bound as an integer and written back. The value is drawn per run, so a framework that answered from a table would have had to know it in advance, and the echo is checked against what was sent.
GET /parameters/{run.one}/segment/literalNo body.
HTTP 200
payload items.small
{"size":"small","count":1,"items":[{"id":1,"name":"slate-lamp-6647","category":"tools","priceCents":18928,"inStock":true}],"echo":{"one":{run.one}}}Compared as parsed JSON, so key order and how a number is written do not matter.
import { performanceTest } from "#kit";
import { items } from "#payloads";
const path = "/parameters/{run.one}/segment/literal";
export default performanceTest({
id: { family: "parameters", name: "one" },
path,
base: "parameters.static",
varies: "captures",
heft: 1,
about:
"One segment captured, bound as an integer and written back. The value is " +
"drawn per run, so a framework that answered from a table would have had " +
"to know it in advance, and the echo is checked against what was sent.",
request: (c) => c.get(`/parameters/${c.run.one}/segment/literal`).okWith(items.small, { echo: ["one"] }),
});
The same depth with a second capture in it. Read against parameters.one, the difference is one more segment the router has to capture and one more value the framework has to convert.
GET /parameters/{run.one}/with-second/{run.two}No body.
HTTP 200
payload items.small
{"size":"small","count":1,"items":[{"id":1,"name":"slate-lamp-6647","category":"tools","priceCents":18928,"inStock":true}],"echo":{"one":{run.one},"two":{run.two}}}Compared as parsed JSON, so key order and how a number is written do not matter.
import { performanceTest } from "#kit";
import { items } from "#payloads";
const path = "/parameters/{run.one}/with-second/{run.two}";
export default performanceTest({
id: { family: "parameters", name: "two" },
path,
base: "parameters.one",
varies: "captures",
heft: 1,
about:
"The same depth with a second capture in it. Read against parameters.one, " +
"the difference is one more segment the router has to capture and one " +
"more value the framework has to convert.",
request: (c) =>
c.get(`/parameters/${c.run.one}/with-second/${c.run.two}`).okWith(items.small, { echo: ["one", "two"] }),
});
The same depth with three of its four segments captured, which leaves parameters as the only static one. Read against parameters.two, the difference is a third segment the router has to capture and a third value the framework has to convert.
GET /parameters/{run.one}/{run.two}/{run.three}No body.
HTTP 200
payload items.small
{"size":"small","count":1,"items":[{"id":1,"name":"slate-lamp-6647","category":"tools","priceCents":18928,"inStock":true}],"echo":{"one":{run.one},"two":{run.two},"three":{run.three}}}Compared as parsed JSON, so key order and how a number is written do not matter.
import { performanceTest } from "#kit";
import { items } from "#payloads";
const path = "/parameters/{run.one}/{run.two}/{run.three}";
export default performanceTest({
id: { family: "parameters", name: "three" },
path,
base: "parameters.two",
varies: "captures",
heft: 1,
about:
"The same depth with three of its four segments captured, which leaves " +
"parameters as the only static one. Read against parameters.two, the " +
"difference is a third segment the router has to capture and a third " +
"value the framework has to convert.",
request: (c) =>
c.get(`/parameters/${c.run.one}/${c.run.two}/${c.run.three}`).okWith(items.small, { echo: ["one", "two", "three"] }),
});