diff --git a/content/blog/inkan-0-10.mdx b/content/blog/inkan-0-10.mdx index cf43256..abe1be9 100644 --- a/content/blog/inkan-0-10.mdx +++ b/content/blog/inkan-0-10.mdx @@ -3,7 +3,6 @@ title: "Your API, as tools a model can call" description: "inkan 0.10 serves every route as an MCP tool, made from the contract the route already has, and checks that what a model gets is what the docs say." date: "2026-11-13" author: "Vensin" -draft: true --- Every inkan route carries its contract: what goes in, what comes out, and a few examples of @@ -62,8 +61,10 @@ server as a process. `-H "authorization: Bearer …"` hands it a token. The docs Without `mcp` nothing changes on the request path. While measuring I found that `app.inject` had picked up an extra turn per request, and fixed it: the in-process bench is now -about 4 % faster than 0.9.4, almost all of it in `inject`, which only your tests use. The -numbers over the network are in the release notes. +about 4 % faster than 0.9.4, almost all of it in `inject`, which only your tests use. Over +the network, on the GitHub runner, inkan scores 89.8 against 0.9.4's 89.7 and Fastify's +88.6 (median of three runs), ahead of Fastify in all three but not in every scenario. The +[benchmarks page](/benchmarks) has the table. ## Next diff --git a/content/docs/performance.mdx b/content/docs/performance.mdx index 5c691fe..8d4ca7c 100644 --- a/content/docs/performance.mdx +++ b/content/docs/performance.mdx @@ -15,23 +15,24 @@ after a warm-up, 3 rounds each; the median of three such runs: | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | | **inkan on uWebSockets.js** ¹ | **134.4** | 147 % | 148 % | 104 % | 99 % | 149 % | 154 % | 115 % | | node:http, by hand | 100 | 100 % | 100 % | 100 % | 100 % | 100 % | 100 % | 100 % | -| **inkan** | **89.4** | **94 %** | 89 % | 86 % | 90 % | 89 % | **93 %** | 74 % | -| **inkan, sealed** | 88.3 | 85 % | **92 %** | **98 %** | 88 % | 89 % | 88 % | 76 % | -| Fastify | 87.2 | 88 % | 91 % | 91 % | 76 % | **90 %** | 87 % | 59 % | -| Hono | 82.5 | 84 % | 71 % | 94 % | **99 %** | 71 % | 74 % | **84 %** | -| Express | 46.1 | 44 % | 46 % | 71 % | 72 % | 23 % | 22 % | 50 % | +| **inkan** | **89.8** | 90 % | **93 %** | 87 % | 88 % | 91 % | **95 %** | 81 % | +| **inkan, sealed** ² | 88.3 | 85 % | 92 % | **98 %** | 88 % | 89 % | 88 % | 76 % | +| Fastify | 88.6 | 92 % | 90 % | 93 % | 80 % | **94 %** | 92 % | 76 % | +| Hono | 85.6 | **94 %** | 77 % | 93 % | **98 %** | 77 % | 85 % | **87 %** | +| Express | 48.9 | 53 % | 52 % | 69 % | 73 % | 23 % | 23 % | 53 % | ¹ With [`@inkanjs/uws`](/docs/integrations/uws), measured with 0.6.0 in a run of its own, against `node:http` in that run. +² Measured with 0.9.0, in the runs of that release. The score is the geometric mean over all twelve scenarios against bare `node:http`, so no single one can carry or sink a server. inkan does a little more per request than the others: it gives every request an id and keeps back every key an answer's contract does not list. Read the numbers as a range, not a rank: a run on another day moves each server by a few points. inkan is a little ahead of Fastify: in front in all -three runs, by about two points, but not in every scenario (Fastify leads the body of 50, the -async handler and 3 middlewares). As fast as 0.8. With `inkan seal`, a body of 50 objects is -checked faster than by any of them. The runs of 0.9.0 are in -[`bench/reports/0.9.0.md`](https://github.com/inkanjs/inkan/blob/main/bench/reports/0.9.0.md). +three runs, by one to two points, but not in every scenario (Fastify leads the body of 50, the +400 routes and 3 middlewares). As fast as 0.9. With `inkan seal`, a body of 50 objects is +checked faster than by any of them. The runs of 0.10.0 are in +[`bench/reports/0.10.0.md`](https://github.com/inkanjs/inkan/blob/main/bench/reports/0.10.0.md). Run it yourself: `cd bench && npm install && node run.mjs`, or the `bench` workflow on GitHub, which also measures what one request costs the server in CPU time. diff --git a/data/bench.ts b/data/bench.ts index 5b98c10..3b79841 100644 --- a/data/bench.ts +++ b/data/bench.ts @@ -4,7 +4,7 @@ // A new run: change `run` and the values, nothing else on the page needs to move. export const run = { - date: "2026-11-03", + date: "2026-11-13", machine: "GitHub Actions runner, 4 cores", tool: "autocannon", seconds: 15, @@ -35,14 +35,15 @@ export type Server = { values: Record; }; -// inkan 0.9.0: the median of three runs of the release bench, every server in each run; -// inkan on uWebSockets.js still from its own run with 0.6.0, against node:http in that run. +// inkan 0.10.0: the median of three runs of the release bench, every server in each run; +// inkan sealed from the runs of 0.9.0, and inkan on uWebSockets.js from its own run with +// 0.6.0, each against node:http in its run. export const servers: Server[] = [ { name: "inkan on uWebSockets.js", what: "@inkanjs/uws, measured with 0.6.0", ours: true, score: 134.4, values: { hello: 147, params: 148, body: 104, answer: 99, router: 149, notFound: 154, invalid: 115 } }, { name: "node:http, by hand", what: "the baseline", base: true, score: 100, values: { hello: 100, params: 100, body: 100, answer: 100, router: 100, notFound: 100, invalid: 100 } }, - { name: "inkan", what: "on node:http", ours: true, score: 89.4, values: { hello: 94, params: 89, body: 86, answer: 90, router: 89, notFound: 93, invalid: 74 } }, - { name: "inkan, sealed", what: "inkan seal", ours: true, score: 88.3, values: { hello: 85, params: 92, body: 98, answer: 88, router: 89, notFound: 88, invalid: 76 } }, - { name: "Fastify", what: "schemas, like inkan", score: 87.2, values: { hello: 88, params: 91, body: 91, answer: 76, router: 90, notFound: 87, invalid: 59 } }, - { name: "Hono", what: "checks by hand", score: 82.5, values: { hello: 84, params: 71, body: 94, answer: 99, router: 71, notFound: 74, invalid: 84 } }, - { name: "Express", what: "checks by hand", score: 46.1, values: { hello: 44, params: 46, body: 71, answer: 72, router: 23, notFound: 22, invalid: 50 } }, + { name: "inkan", what: "on node:http", ours: true, score: 89.8, values: { hello: 90, params: 93, body: 87, answer: 88, router: 91, notFound: 95, invalid: 81 } }, + { name: "inkan, sealed", what: "inkan seal, measured with 0.9.0", ours: true, score: 88.3, values: { hello: 85, params: 92, body: 98, answer: 88, router: 89, notFound: 88, invalid: 76 } }, + { name: "Fastify", what: "schemas, like inkan", score: 88.6, values: { hello: 92, params: 90, body: 93, answer: 80, router: 94, notFound: 92, invalid: 76 } }, + { name: "Hono", what: "checks by hand", score: 85.6, values: { hello: 94, params: 77, body: 93, answer: 98, router: 77, notFound: 85, invalid: 87 } }, + { name: "Express", what: "checks by hand", score: 48.9, values: { hello: 53, params: 52, body: 69, answer: 73, router: 23, notFound: 23, invalid: 53 } }, ];