Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(libquery): remove dmmf #4790

Merged
merged 3 commits into from
May 13, 2024
Merged

chore(libquery): remove dmmf #4790

merged 3 commits into from
May 13, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Mar 25, 2024

This PR removes the dmmf method from the libquery query engine.
Context: during a conversation with @SevInf on Slack, it turned out that this dmmf method was never called by @prisma/client.

/integration

@jkomyno jkomyno self-assigned this Mar 25, 2024
@jkomyno jkomyno added this to the 5.12.0 milestone Mar 25, 2024
Copy link
Contributor

github-actions bot commented Mar 25, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.153MiB 2.153MiB 0.000B
Postgres (gzip) 846.111KiB 846.112KiB -1.000B
Mysql 2.121MiB 2.121MiB 0.000B
Mysql (gzip) 832.563KiB 832.565KiB -2.000B
Sqlite 2.015MiB 2.015MiB 0.000B
Sqlite (gzip) 793.470KiB 793.469KiB 1.000B

Copy link

codspeed-hq bot commented Mar 25, 2024

CodSpeed Performance Report

Merging #4790 will not alter performance

Comparing feat/qe-remove-dmmf (05d5d2d) with main (079da82)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented Mar 25, 2024

✅ WASM query-engine performance won't change substantially (1.007x)

Full benchmark report
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/bench?schema=imdb_bench&sslmode=disable" \
node --experimental-wasm-modules query-engine/driver-adapters/executor/dist/bench.mjs
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
cpu: AMD EPYC 7763 64-Core Processor
runtime: node v18.20.2 (x64-linux)

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     374 ms/iter       (370 ms … 395 ms)    373 ms    395 ms    395 ms
Web Assembly: Latest       459 ms/iter       (455 ms … 468 ms)    463 ms    468 ms    468 ms
Web Assembly: Current      459 ms/iter       (456 ms … 463 ms)    462 ms    463 ms    463 ms
Node API: Current          202 ms/iter       (197 ms … 209 ms)    208 ms    209 ms    209 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.27x slower than Node API: Current
   1.23x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  15'032 µs/iter (14'765 µs … 15'727 µs) 15'098 µs 15'727 µs 15'727 µs
Web Assembly: Latest    18'674 µs/iter (18'459 µs … 19'098 µs) 18'709 µs 19'098 µs 19'098 µs
Web Assembly: Current   18'841 µs/iter (18'463 µs … 19'899 µs) 18'881 µs 19'899 µs 19'899 µs
Node API: Current        8'279 µs/iter   (8'035 µs … 8'923 µs)  8'345 µs  8'923 µs  8'923 µs

summary for movies.findMany({ take: 2000 })
  Web Assembly: Current
   2.28x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'349 µs/iter   (2'182 µs … 4'041 µs)  2'316 µs  3'719 µs  4'041 µs
Web Assembly: Latest     2'922 µs/iter   (2'793 µs … 5'229 µs)  2'884 µs  3'816 µs  5'229 µs
Web Assembly: Current    2'944 µs/iter   (2'799 µs … 4'678 µs)  2'892 µs  4'566 µs  4'678 µs
Node API: Current        1'428 µs/iter   (1'325 µs … 1'909 µs)  1'433 µs  1'830 µs  1'909 µs

summary for movies.findMany({ where: {...}, take: 2000 })
  Web Assembly: Current
   2.06x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     570 ms/iter       (564 ms … 592 ms)    572 ms    592 ms    592 ms
Web Assembly: Latest       779 ms/iter       (773 ms … 789 ms)    780 ms    789 ms    789 ms
Web Assembly: Current      786 ms/iter       (782 ms … 812 ms)    788 ms    812 ms    812 ms
Node API: Current          477 ms/iter       (460 ms … 496 ms)    489 ms    496 ms    496 ms

summary for movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.65x slower than Node API: Current
   1.38x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  79'149 µs/iter (78'160 µs … 79'992 µs) 79'907 µs 79'992 µs 79'992 µs
Web Assembly: Latest       110 ms/iter       (110 ms … 111 ms)    111 ms    111 ms    111 ms
Web Assembly: Current      112 ms/iter       (111 ms … 113 ms)    113 ms    113 ms    113 ms
Node API: Current       62'489 µs/iter (61'455 µs … 64'746 µs) 63'333 µs 64'746 µs 64'746 µs

summary for movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.79x slower than Node API: Current
   1.41x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'003 ms/iter     (999 ms … 1'008 ms)  1'006 ms  1'008 ms  1'008 ms
Web Assembly: Latest     1'294 ms/iter   (1'287 ms … 1'320 ms)  1'300 ms  1'320 ms  1'320 ms
Web Assembly: Current    1'307 ms/iter   (1'295 ms … 1'327 ms)  1'324 ms  1'327 ms  1'327 ms
Node API: Current          880 ms/iter       (847 ms … 895 ms)    893 ms    895 ms    895 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.48x slower than Node API: Current
   1.3x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     142 ms/iter       (141 ms … 144 ms)    143 ms    144 ms    144 ms
Web Assembly: Latest       184 ms/iter       (182 ms … 186 ms)    186 ms    186 ms    186 ms
Web Assembly: Current      185 ms/iter       (184 ms … 188 ms)    185 ms    188 ms    188 ms
Node API: Current          111 ms/iter       (109 ms … 113 ms)    112 ms    113 ms    113 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.67x slower than Node API: Current
   1.3x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'099 µs/iter     (999 µs … 1'979 µs)  1'059 µs  1'954 µs  1'979 µs
Web Assembly: Latest     1'371 µs/iter   (1'297 µs … 2'000 µs)  1'373 µs  1'828 µs  2'000 µs
Web Assembly: Current    1'375 µs/iter   (1'312 µs … 2'189 µs)  1'379 µs  2'105 µs  2'189 µs
Node API: Current          782 µs/iter     (753 µs … 1'187 µs)    794 µs    830 µs  1'187 µs

summary for movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
  Web Assembly: Current
   1.76x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'049 µs/iter   (1'008 µs … 1'503 µs)  1'051 µs  1'370 µs  1'503 µs
Web Assembly: Latest     1'383 µs/iter   (1'327 µs … 1'996 µs)  1'383 µs  1'776 µs  1'996 µs
Web Assembly: Current    1'391 µs/iter   (1'339 µs … 2'027 µs)  1'395 µs  1'695 µs  2'027 µs
Node API: Current          790 µs/iter     (723 µs … 1'365 µs)    791 µs  1'192 µs  1'365 µs

summary for movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
  Web Assembly: Current
   1.76x slower than Node API: Current
   1.33x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

After changes in 05d5d2d

@jkomyno
Copy link
Contributor Author

jkomyno commented Mar 25, 2024

❌ WASM query-engine performance will worsen by 1.83%

Full benchmark report
After changes in 0ee5905

This report doesn't make any sense. Wasm Query Engine isn't affected at all by this PR.

@Jolg42 Jolg42 modified the milestones: 5.12.0, 5.13.0 Apr 2, 2024
@jkomyno jkomyno marked this pull request as ready for review May 13, 2024 09:22
@jkomyno jkomyno requested a review from a team as a code owner May 13, 2024 09:22
@jkomyno jkomyno requested review from Druue and SevInf and removed request for a team and Druue May 13, 2024 09:22
@jkomyno jkomyno modified the milestones: 5.13.0, 5.14.0 May 13, 2024
@SevInf
Copy link
Contributor

SevInf commented May 13, 2024

I think dependency on dmmf crate can be removed too?

@jkomyno
Copy link
Contributor Author

jkomyno commented May 13, 2024

I think dependency on dmmf crate can be removed too?

dmmf is a transitive dependency of request_handlers.
request_handlers::dmmf is still used by the binary query-engine. Though, to be honest, I don't see any dmmf reference in https://github.com/prisma/prisma/blob/main/packages/client/src/runtime/core/engines/binary/BinaryEngine.ts

@jkomyno jkomyno merged commit 879beb2 into main May 13, 2024
182 checks passed
@jkomyno jkomyno deleted the feat/qe-remove-dmmf branch May 13, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants