Avatar for the prisma user
prisma
prisma-engines
BlogDocsChangelog

Performance History

Latest Results

chore: rebuild
test/cover-parameterization
7 hours ago
chore: comment out a test
test/cover-parameterization
11 hours ago
fix: handle JSON lists correctly
test/cover-parameterization
17 hours ago
fix: handle mapped enums in parameterization
test/cover-parameterization
24 hours ago
test: cover parameterization
test/cover-parameterization
1 day ago
test: cover parameterization
test/cover-parameterization
1 day ago
test: cover parameterization
test/cover-parameterization
1 day ago
fix: add buffered DMMF API to bypass V8 string length limit (#5757) ## Summary Adds three new `wasm_bindgen` exports to `prisma-schema-wasm` that allow DMMF JSON to be returned as chunked `Uint8Array` data instead of a single JS string, bypassing V8's hard string length limit of `0x1fffffe8` characters (~536MB). - `get_dmmf_buffered(params) -> usize` — serializes DMMF to an internal buffer using `serde_json::to_vec()`, returns total byte count - `read_dmmf_chunk(offset, length) -> Vec<u8>` — returns a chunk as `Uint8Array` (no V8 string limit) - `free_dmmf_buffer()` — releases the internal buffer The existing `get_dmmf()` is unchanged for backward compatibility. ## Root Cause `dmmf_json_from_validated_schema()` in `query-compiler/dmmf/src/lib.rs` uses `serde_json::to_string()`, producing a single Rust `String`. When `wasm-bindgen` converts this to a JS string across the WASM FFI boundary, V8 rejects it if the string exceeds `0x1fffffe8` characters. No Node.js flags can change this limit — it's a V8 engine constant. ## Changes | File | Change | |------|--------| | `query-compiler/dmmf/src/lib.rs` | Add `dmmf_json_bytes_from_validated_schema()` using `serde_json::to_vec()` | | `prisma-fmt/src/get_dmmf.rs` | Add `get_dmmf_bytes()` returning `Vec<u8>` | | `prisma-fmt/src/lib.rs` | Export `get_dmmf_bytes()` | | `prisma-schema-wasm/src/lib.rs` | Add 3 new `wasm_bindgen` exports with `Mutex<Vec<u8>>` buffer | **+76 lines, 4 files changed.** No existing behavior modified. ## Test Results Tested with a production schema (1,600+ models, 1,100+ enums, 111K lines): | Test | Result | Details | |------|--------|---------| | Original `get_dmmf()` | **FAILS** | `Cannot create a string longer than 0x1fffffe8 characters` | | `get_dmmf_buffered()` + chunked read | **PASSES** | 571MB DMMF, 35 chunks x 16MB each | | Streaming JSON parse of chunks | **PASSES** | Full parse completed in ~21s | ## Limitations This fix addresses the V8 string length limit but has an upper bound: WASM32 linear memory is capped at ~4GB. For schemas producing DMMF larger than ~4GB, the buffered approach would also fail. An alternative for extreme cases would be using the native schema engine binary path (which streams over stdio with no memory limit), but the buffered API should cover schemas well into the tens of thousands of models. ## Companion Change Required The TypeScript side (`prisma/prisma` — `getDmmfWasm` in `packages/internals`) needs to detect the V8 string limit error and fall back to the buffered API with a streaming JSON parser. Both this PR and the companion TypeScript PR are required for a complete fix. We will submit the companion PR to `prisma/prisma` as well. Fixes: https://github.com/prisma/prisma/issues/29111 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added new DMMF API supporting chunked data reading from JavaScript applications * Implemented buffer-based retrieval mechanism enabling efficient access to schema metadata * New functionality includes size checking methods and safe bounds-checked reading operations * Improved memory efficiency for large schema operations <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jacek Malec <malec@prisma.io>
main
8 days ago

Latest Branches

CodSpeed Performance Gauge
0%
test: cover parameterization in query tests#5801
7 hours ago
0f47461
test/cover-parameterization
CodSpeed Performance Gauge
0%
fix: add buffered DMMF API to bypass V8 string length limit#5757
8 days ago
ee8c8a0
chris-tophers:fix/dmmf-v8-string-limit
CodSpeed Performance Gauge
0%
19 days ago
3c9de00
dependabot/npm_and_yarn/libs/driver-adapters/executor/undici-6.24.0
© 2026 CodSpeed Technology
Home Terms Privacy Docs