Query string parsing, percent-decoding and coercion, with the values echoed and put to no other use.
Comparable across every framework. Eight parameters on the many row, because eight is what a real search endpoint carries: a page and a size, a sort, a text term and four filters.
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 |
|---|---|---|---|---|
| query.one | 1 | GET /query/one?page={run.page} | json.small | more query string keys parsed, coerced and echoed |
| query.many | 2 | GET /query/many?page={run.page}&size={run.size}&status={run.status}&category={run.category}&sort={run.sort}&q={run.q}&minPrice={run.minPrice}&maxPrice={run.maxPrice} | query.one | more query string keys parsed, coerced and echoed |
One query parameter parsed, coerced to an integer and written back. Read against json.small, the difference is the query string being parsed at all.
GET /query/one?page={run.page}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":{"page":{run.page}}}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 = "/query/one?page={run.page}";
export default performanceTest({
id: { family: "query", name: "one" },
path,
base: "json.small",
varies: "query_params",
heft: 1,
about:
"One query parameter parsed, coerced to an integer and written back. Read " +
"against json.small, the difference is the query string being parsed at " +
"all.",
request: (c) => c.get("/query/one").query("page", String(c.run.page)).okWith(items.small, { echo: ["page"] }),
});
Eight parameters, which is what a real search endpoint carries: a page and a size, a sort, a text term and four filters. Read against query.one, the difference is seven more keys parsed, coerced and echoed.
GET /query/many?page={run.page}&size={run.size}&status={run.status}&category={run.category}&sort={run.sort}&q={run.q}&minPrice={run.minPrice}&maxPrice={run.maxPrice}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":{"page":{run.page},"size":{run.size},"status":"{run.status}","category":"{run.category}","sort":"{run.sort}","q":"{run.q}","minPrice":{run.minPrice},"maxPrice":{run.maxPrice}}}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 = "/query/many?page={run.page}&size={run.size}&status={run.status}&category={run.category}&sort={run.sort}&q={run.q}&minPrice={run.minPrice}&maxPrice={run.maxPrice}";
export default performanceTest({
id: { family: "query", name: "many" },
path,
base: "query.one",
varies: "query_params",
heft: 2,
about:
"Eight parameters, which is what a real search endpoint carries: a page " +
"and a size, a sort, a text term and four filters. Read against " +
"query.one, the difference is seven more keys parsed, coerced and echoed.",
request: (c) =>
c
.get("/query/many")
.query("page", String(c.run.page))
.query("size", String(c.run.size))
.query("status", c.run.status)
.query("category", c.run.category)
.query("sort", c.run.sort)
.query("q", c.run.q)
.query("minPrice", String(c.run.minPrice))
.query("maxPrice", String(c.run.maxPrice))
.okWith(items.small, { echo: ["page", "size", "status", "category", "sort", "q", "minPrice", "maxPrice"] }),
});