prisma-engines icon indicating copy to clipboard operation
prisma-engines copied to clipboard

fix(join): properly coerce json list

Open Weakky opened this issue 1 year ago • 3 comments

Overview

fixes https://github.com/prisma/prisma/issues/22923

Weakky avatar Feb 02 '24 13:02 Weakky

WASM Size

Engine This PR Base branch Diff
Postgres 2.062MiB 2.062MiB 370.000B
Postgres (gzip) 814.482KiB 814.262KiB 225.000B
Mysql 2.045MiB 2.044MiB 370.000B
Mysql (gzip) 806.300KiB 806.135KiB 169.000B
Sqlite 2.005MiB 2.005MiB 370.000B
Sqlite (gzip) 792.662KiB 792.512KiB 153.000B

github-actions[bot] avatar Feb 02 '24 13:02 github-actions[bot]

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

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.19.1 (x64-linux)

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     289 ms/iter       (285 ms … 293 ms)    291 ms    293 ms    293 ms
Web Assembly: Latest       370 ms/iter       (369 ms … 371 ms)    370 ms    371 ms    371 ms
Web Assembly: Current      372 ms/iter       (370 ms … 373 ms)    373 ms    373 ms    373 ms
Node API: Current          206 ms/iter       (191 ms … 218 ms)    215 ms    218 ms    218 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   1.8x slower than Node API: Current
   1.29x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  11'522 µs/iter (11'225 µs … 14'210 µs) 11'361 µs 14'210 µs 14'210 µs
Web Assembly: Latest    15'058 µs/iter (14'660 µs … 16'511 µs) 15'094 µs 16'511 µs 16'511 µs
Web Assembly: Current   15'148 µs/iter (14'937 µs … 16'291 µs) 15'149 µs 16'291 µs 16'291 µs
Node API: Current        7'947 µs/iter   (7'833 µs … 8'115 µs)  7'979 µs  8'115 µs  8'115 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'847 µs/iter   (1'756 µs … 2'776 µs)  1'839 µs  2'556 µs  2'776 µs
Web Assembly: Latest     2'401 µs/iter   (2'310 µs … 3'218 µs)  2'397 µs  2'953 µs  3'218 µs
Web Assembly: Current    2'429 µs/iter   (2'334 µs … 3'121 µs)  2'421 µs  3'063 µs  3'121 µs
Node API: Current        1'388 µs/iter   (1'314 µs … 1'790 µs)  1'398 µs  1'599 µs  1'790 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     551 ms/iter       (544 ms … 569 ms)    564 ms    569 ms    569 ms
Web Assembly: Latest       732 ms/iter       (726 ms … 749 ms)    747 ms    749 ms    749 ms
Web Assembly: Current      729 ms/iter       (725 ms … 741 ms)    735 ms    741 ms    741 ms
Node API: Current          451 ms/iter       (443 ms … 470 ms)    467 ms    470 ms    470 ms

summary for movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.62x slower than Node API: Current
   1.32x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  76'495 µs/iter (75'827 µs … 78'701 µs) 76'503 µs 78'701 µs 78'701 µs
Web Assembly: Latest       102 ms/iter       (102 ms … 103 ms)    103 ms    103 ms    103 ms
Web Assembly: Current      103 ms/iter       (102 ms … 104 ms)    103 ms    104 ms    104 ms
Node API: Current       60'167 µs/iter (59'824 µs … 60'610 µs) 60'381 µs 60'610 µs 60'610 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     979 ms/iter     (972 ms … 1'000 ms)    979 ms  1'000 ms  1'000 ms
Web Assembly: Latest     1'216 ms/iter   (1'204 ms … 1'240 ms)  1'239 ms  1'240 ms  1'240 ms
Web Assembly: Current    1'213 ms/iter   (1'206 ms … 1'237 ms)  1'216 ms  1'237 ms  1'237 ms
Node API: Current          883 ms/iter       (852 ms … 908 ms)    902 ms    908 ms    908 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.37x slower than Node API: Current
   1.24x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     138 ms/iter       (137 ms … 139 ms)    138 ms    139 ms    139 ms
Web Assembly: Latest       169 ms/iter       (169 ms … 170 ms)    169 ms    170 ms    170 ms
Web Assembly: Current      169 ms/iter       (169 ms … 173 ms)    170 ms    173 ms    173 ms
Node API: Current          104 ms/iter       (103 ms … 106 ms)    106 ms    106 ms    106 ms

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

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     872 µs/iter     (816 µs … 1'496 µs)    868 µs  1'368 µs  1'496 µs
Web Assembly: Latest     1'222 µs/iter   (1'150 µs … 1'814 µs)  1'214 µs  1'645 µs  1'814 µs
Web Assembly: Current    1'224 µs/iter   (1'156 µs … 1'778 µs)  1'220 µs  1'676 µs  1'778 µs
Node API: Current          788 µs/iter     (702 µs … 1'355 µs)    802 µs  1'124 µs  1'355 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     864 µs/iter     (819 µs … 1'518 µs)    867 µs  1'227 µs  1'518 µs
Web Assembly: Latest     1'196 µs/iter   (1'149 µs … 1'751 µs)  1'203 µs  1'492 µs  1'751 µs
Web Assembly: Current    1'209 µs/iter   (1'162 µs … 1'662 µs)  1'217 µs  1'503 µs  1'662 µs
Node API: Current          770 µs/iter     (709 µs … 1'051 µs)    792 µs    917 µs  1'051 µs

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

After changes in 9eea31a9bd6c3b5ab225ad5d36f7f781446638c2

github-actions[bot] avatar Feb 02 '24 13:02 github-actions[bot]

CodSpeed Performance Report

Merging #4690 will not alter performance

Comparing fix/join-json-list (9eea31a) with main (af6ceee)

Summary

✅ 11 untouched benchmarks

codspeed-hq[bot] avatar Feb 02 '24 13:02 codspeed-hq[bot]