···11+import { setup } from "@ark/attest";
22+33+// config options can be passed here
44+export default () =>
55+ setup({
66+ // Set to true during development to skip type checking (faster)
77+ skipTypes: false,
88+99+ // Fail if benchmarks deviate by more than 20%
1010+ benchPercentThreshold: 20,
1111+ });
+1
src/index.ts
···11export * from "./lib.ts";
22+export * from "./infer.ts";
+44
src/tests/infer.bench.ts
···11+import { test } from "vitest";
22+import { bench } from "@ark/attest";
33+import type { InferNS } from "../infer.ts";
44+import { lx } from "../lib.ts";
55+66+// Dummy test to satisfy Vitest - actual benchmarks run during module load
77+test("type benchmarks", () => {
88+ // Benchmarks run automatically via bench() calls below
99+});
1010+1111+bench("InferNS with simple object", () => {
1212+ const schema = lx.namespace("test.simple", {
1313+ main: lx.object({
1414+ id: lx.string({ required: true }),
1515+ name: lx.string({ required: true }),
1616+ }),
1717+ });
1818+1919+ return null as unknown as InferNS<typeof schema>;
2020+}).types([63, "instantiations"]);
2121+2222+bench("InferNS with complex nested structure", () => {
2323+ const schema = lx.namespace("test.complex", {
2424+ post: lx.record({
2525+ key: "tid",
2626+ record: lx.object({
2727+ author: lx.ref("test.complex#user", { required: true }),
2828+ replies: lx.array(lx.ref("test.complex#reply")),
2929+ content: lx.string({ required: true }),
3030+ createdAt: lx.string({ required: true, format: "datetime" }),
3131+ }),
3232+ }),
3333+ user: lx.object({
3434+ handle: lx.string({ required: true }),
3535+ displayName: lx.string(),
3636+ }),
3737+ reply: lx.object({
3838+ text: lx.string({ required: true }),
3939+ author: lx.ref("test.complex#user", { required: true }),
4040+ }),
4141+ });
4242+4343+ return null as unknown as InferNS<typeof schema>;
4444+}).types([125, "instantiations"]);