Skip to content

Benchmark schema compilation time #1641

Open
@ottomated

Description

@ottomated

In an serverless environment like a Cloudflare worker, schemas may need to be created on every request. This benchmark doesn't take that into account.

I propose adding a new suite that would look something like this. It would need to be somewhat of a complicated schema to measure factors such as string parsing:

createCase('arktype', 'compileSchema', () => {
  return () =>
    type({
      string: 'string',
      stringRange: '0 < string <= 10',
      'optional?': 'number[]',
    });
});

createCase('zod', 'compileSchema', () => {
  return () =>
    z.object({
      string: z.string(),
      stringRange: z.string().min(0).max(10),
      optional: z.array(z.number()).optional(),
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions