Skip to content

prisma/type-benchmarks

Repository files navigation

Type Benchmark Tests

This package contains type benchmarks tests using attest.

These were initially developed together with David Blass.

Usage

  • Make sure the overall monorepo has dependency installed (pnpm install in root) and is build (pnpm -r dev or pnpm build in root).
  • Run pnpm test to run the test suite
  • Run pnpm test:update to update snapshot recordings
  • Run pnpm test <filter> to run only files including in their filename
  • Run pnpm test:update <filter> to only update snapshots of files including in their filename

Structure

  • Each folder in this directory contains a different schema.
  • Each schema can be tested with multiple *.bench.ts files.
  • Each *.bench.ts file can contain multiple attest benchmarks and a dedicated baseline.
  • The generated prisma client for each schema can be found in the generated subfolder after a test run.

Benchmark Files

This project includes several benchmark suites comparing type-checking performance:

Query Benchmarks

  • prisma.query.bench.ts - Prisma ORM queries using generated client types
  • drizzle.query.bench.ts - Drizzle ORM SQL-like query builder with manual joins
  • drizzle.relational.bench.ts - Drizzle ORM Relational Query Builder (RQB) using db.query.* API with with clauses

Schema Benchmarks

  • prisma.schema.bench.ts - Prisma generated types evaluation
  • drizzle.schema.bench.ts - Drizzle schema types evaluation