-
-
Notifications
You must be signed in to change notification settings - Fork 134
Description
I was looking into migrating from Zod and was drawn by the validation benchmarks on both the homepage and blog post. My intuition, however, was that the expensive schema initialization step would make arktype a mistake for serverless environments such as Cloudflare workers where schemas are reinitialized on each request.
I verified it with a quick benchmark that shows a significant performance hit that unfortunately more than outweighs the gain on validation speed:
import { run, bench, boxplot, summary } from 'mitata';
import { z } from 'zod';
import { type } from 'arktype';
boxplot(() => {
summary(() => {
bench('zod', () => z.object({
string: z.string(),
stringRange: z.string().min(0).max(10),
optional: z.array(z.number()).optional(),
}));
bench('arktype', () => type({
string: 'string',
stringRange: '0 < string <= 10',
'optional?': 'number[]',
}));
});
});
await run();I understand that the library is not focused on initialization performance, but it feels a bit misleading to advertise a 100x speedup when a significant portion of your users will actually experience the opposite. Would it be possible to add a note mentioning this to the relevant docs pages?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
