perf(query-compiler): Prisma Client performance groundwork#5820
perf(query-compiler): Prisma Client performance groundwork#5820tensordreams wants to merge 113 commits into
Conversation
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Add a return-preserving flow node for exactly-one nested noop update upserts so the nested write can run while the branch still returns the parent row to a shared final read. This removes the duplicated raw nested read from upsert-nested-only-update. Allocation profile: upsert-nested-only-update full_compile allocs 1835 -> 1475 and bytes 214.4 KiB -> 177.7 KiB; sampled controls unchanged. Criterion: target improved 187.37 -> 149.31 us, repeat 185.21 -> 146.76 us. Focused upsert controls showed only small local noise. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will improve performance by 17.88%
Performance Changes
Tip Curious why this is faster? Comment Comparing Footnotes
|
Wasm Query Compiler File Size
|
Summary
Draft status PR for the engines side of the ongoing Prisma Client performance work. This branch contains query-compiler, query-plan serialization, raw-nested read, and compile-path allocation changes that the sibling Prisma branch consumes.
This is intentionally not merge-ready as a final review unit. The branch is currently large (
113commits ahead,1commit behind freshmain) because it accumulated accepted experiments and measurement infrastructure during the performance investigation. I am opening it now so CI and reviewers can see the real state, then the next packaging step should be slicing it into smaller stacked PRs if this is too much to review at once.Sibling Prisma PR: prisma/prisma#29655
Extracted child PRs:
Current split plan:
wip/client-performance-pr-stack.mdin the sibling Prisma PR branch.Linked Prisma branch for CI
The engines workflow reads this command from the PR body and builds Prisma adapters/client code from the sibling branch:
/prisma-branch prisma-client-performance-2026-06-08
The reciprocal Prisma PR uses
/engine-branch prisma-client-performance-2026-06-08-enginesso Prisma CI builds this engines branch.Main Contents
INSERT ... SELECT ... RETURNINGand insert-in-CTE prerequisites for a future M:N connect phase-owner, while the direct CTE phase-owner prototype itself stayed reverted.Current Performance Readout
See the sibling Prisma report for the cross-repo rollup:
wip/client-performance-intermediate-report.mdonprisma-client-performance-2026-06-08.Important engine-side examples from the journal:
update-set-nested-prisma#27650full-compile allocations1621 -> 1453, Criterion about153.20 -> 135.75 us.nested-distinct-pagination-queryfull-compile allocations726 -> 627, Criterion about75.20 -> 65.90 us.query-m2m-pagination-mapped-distinctfull-compile allocations1519 -> 942, Criterion about134.37 -> 83.23 us.setparent-key delete work:update-m2m-set-empty1547 -> 1208andupdate-m2m-set1922 -> 1586full-compile allocations.upsert-nested-only-updatefull-compile allocations1835 -> 1475, with focused Criterion around187.37 -> 149.31 us.Validation Already Run Locally
Representative accepted slices were validated with combinations of:
cargo check -p query-compilercargo test -p query-compiler --test queriesmake build-qc-wasmfor runtime-consuming query-compiler changesThe latest Prisma-side harness restart revalidated the generated prepared-helper slice against this branch context; see the sibling PR for exact
pnpmcommands.Proposed Review Split
If this draft PR is too large as expected, split into a stack roughly like:
Internal formats in this stack are lockstep-only. There should not be old/new compatibility readers unless a real external persistence boundary is identified.