Why Drizzle ORM on Bun Beats Go’s Latency – Even Evan You Uses It
Drizzle ORM v1.0.0‑rc.1 introduces JIT row mappers and Effect v4 integration, delivering a benchmark where Bun + Drizzle achieves 7.3 ms latency versus Go’s 18.1 ms, with higher CPU usage, and the article analyzes the feature changes, performance trade‑offs, and migration considerations.
What is Drizzle ORM
Drizzle ORM is a TypeScript‑native SQL library introduced around 2022. It positions itself as an ORM that stays close to raw SQL, using a type‑safe query builder rather than a proprietary DSL.
Compared with Prisma, Drizzle defines the schema directly in TypeScript code and writes queries in a code‑style API, giving a smoother learning curve for developers familiar with SQL.
It is lightweight, has few runtime dependencies, and can be deployed to edge environments, which has driven its adoption in lightweight frameworks such as Hono and Elysia.
Changes in v1.0.0‑rc.1
JIT row mappers – near‑zero ORM overhead
Traditional ORMs map each returned row to a JavaScript object at runtime, iterating fields and performing type conversion, which adds noticeable cost under high concurrency.
Drizzle now compiles a schema‑specific mapping function at runtime. The generated function handles only the fields of the target table and eliminates generic dynamic checks, effectively creating a JIT‑compiled fast path that the official benchmark claims reduces ORM overhead to near zero, comparable to hand‑written drivers.
Effect v4 native support
Effect is a functional programming library for TypeScript that provides type‑safe error handling, dependency injection, and concurrency management. Drizzle now integrates with Effect v4, allowing database operations inside Effect.gen with full type inference of errors, removing the need for manual try/catch.
import { PgClient } from '@effect/sql-pg';
import * as PgDrizzle from 'drizzle-orm/effect-postgres';
import * as Effect from 'effect/Effect';
const DB = PgDrizzle.make({ relations }).pipe(
Effect.provide(PgDrizzle.DefaultServices)
);
const program = Effect.gen(function* () {
const db = yield* DB;
const users = yield* db.select().from(usersTable);
}).pipe(Effect.provide(PgClientLive));
await Effect.runPromise(program);Casing API refactor (breaking change)
The previous scattered approach to camelCase ↔ snake_case conversion has been unified. The new API declares the naming strategy when creating a table or schema.
import * as d from "drizzle-orm/pg-core";
// snake_case strategy
const users = d.snakeCase.table("users", {
id: d.serial().primaryKey(),
email: d.text().unique(),
fullName: d.text(),
createdAt: d.timestamp().defaultNow(),
});
// camelCase schema
const schema2 = d.camelCase.schema("schema2");
const usersInSchema2 = schema2.table("users", ...);Projects using the old casing configuration must follow the official migration guide.
Drizzle for LLM agents (preview)
A preview branch drizzle-orm@ai aims to let LLM agents understand and manipulate the database schema managed by Drizzle. Interested users can join the discussion on Discord.
Analyzing the benchmark
The official benchmark compares a full HTTP service built with Bun v1.3.13 + Bun SQL + Drizzle JIT against Go v1.25.5 with an unspecified driver. Drizzle shows 7.3 ms average latency and 8.8 k req/s throughput, while Go shows 18.1 ms latency and 8.2 k req/s.
CPU usage is higher for Drizzle (81.6 % vs 75.5 % for Go), indicating the latency gain costs additional compute. The benchmark is self‑produced; the Go side’s configuration is not disclosed, leaving room for tuning.
Therefore the numbers are valid as a reference but should not be taken as proof that JavaScript is universally faster than Go.
Drizzle vs. Prisma
Prisma has grown heavier over four years, with some community concerns about migration cost. Drizzle’s lightweight, type‑safe, SQL‑proximate design appeals to developers looking for a leaner alternative.
Prisma still offers richer documentation, a larger community, and mature tooling for complex relations and migrations, so the two are not direct replacements.
Should you migrate?
If your existing project runs well with Prisma, there is no urgent need to switch to a release candidate that introduces breaking changes.
For new projects, especially those targeting Bun or lightweight stacks like Hono/Elysia, Drizzle is worth serious consideration. Its JIT mapping delivers measurable performance gains, and its TypeScript type inference handles complex queries effectively.
Pay particular attention to the casing API breaking change and review the official changelog before upgrading.
To try the release candidate, use the tag @1.0.0-rc.1 or consult the official benchmark page for full test configurations.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
