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

Integration branch for #4336

Open aqrln opened this issue 2 years ago • 3 comments

https://github.com/prisma/prisma-engines/pull/4336

aqrln avatar Apr 10 '24 18:04 aqrln

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.123MiB 2.122MiB 302.000B
Postgres (gzip) 835.804KiB 835.682KiB 125.000B
Mysql 2.093MiB 2.092MiB 293.000B
Mysql (gzip) 823.950KiB 823.416KiB 547.000B
Sqlite 1.988MiB 1.987MiB 296.000B
Sqlite (gzip) 784.080KiB 783.936KiB 147.000B

github-actions[bot] avatar Apr 10 '24 18:04 github-actions[bot]

CodSpeed Performance Report

Merging #4823 will degrade performances by 5.46%

Comparing integration/qe-always-create-a-span-for-prisma-engine-regardless-of-itx (46637e0) with main (6144ce0)

Summary

❌ 1 regressions ✅ 10 untouched benchmarks

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main integration/qe-always-create-a-span-for-prisma-engine-regardless-of-itx Change
large_read 7.7 ms 8.1 ms -5.46%

codspeed-hq[bot] avatar Apr 10 '24 18:04 codspeed-hq[bot]

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

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

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     364 ms/iter       (361 ms … 371 ms)    365 ms    371 ms    371 ms
Web Assembly: Latest       449 ms/iter       (448 ms … 450 ms)    450 ms    450 ms    450 ms
Web Assembly: Current      448 ms/iter       (446 ms … 451 ms)    450 ms    451 ms    451 ms
Node API: Current          199 ms/iter       (197 ms … 203 ms)    199 ms    203 ms    203 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.26x 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  14'917 µs/iter (14'638 µs … 17'435 µs) 14'779 µs 17'435 µs 17'435 µs
Web Assembly: Latest    18'291 µs/iter (18'174 µs … 18'928 µs) 18'323 µs 18'928 µs 18'928 µs
Web Assembly: Current   18'503 µs/iter (17'969 µs … 22'174 µs) 18'851 µs 22'174 µs 22'174 µs
Node API: Current        8'070 µs/iter   (7'936 µs … 8'396 µs)  8'094 µs  8'396 µs  8'396 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'271 µs/iter   (2'176 µs … 3'396 µs)  2'263 µs  3'091 µs  3'396 µs
Web Assembly: Latest     2'855 µs/iter   (2'763 µs … 3'629 µs)  2'849 µs  3'438 µs  3'629 µs
Web Assembly: Current    2'827 µs/iter   (2'733 µs … 3'489 µs)  2'823 µs  3'231 µs  3'489 µs
Node API: Current        1'451 µs/iter   (1'322 µs … 2'297 µs)  1'435 µs  2'115 µs  2'297 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     565 ms/iter       (558 ms … 590 ms)    565 ms    590 ms    590 ms
Web Assembly: Latest       784 ms/iter       (778 ms … 810 ms)    785 ms    810 ms    810 ms
Web Assembly: Current      780 ms/iter       (772 ms … 800 ms)    792 ms    800 ms    800 ms
Node API: Current          474 ms/iter       (465 ms … 489 ms)    481 ms    489 ms    489 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  77'842 µs/iter (77'623 µs … 78'264 µs) 78'053 µs 78'264 µs 78'264 µs
Web Assembly: Latest       110 ms/iter       (110 ms … 110 ms)    110 ms    110 ms    110 ms
Web Assembly: Current      109 ms/iter       (109 ms … 111 ms)    110 ms    111 ms    111 ms
Node API: Current       60'863 µs/iter (60'104 µs … 61'714 µs) 61'601 µs 61'714 µs 61'714 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'008 ms/iter   (1'001 ms … 1'024 ms)  1'022 ms  1'024 ms  1'024 ms
Web Assembly: Latest     1'304 ms/iter   (1'297 ms … 1'315 ms)  1'306 ms  1'315 ms  1'315 ms
Web Assembly: Current    1'303 ms/iter   (1'289 ms … 1'314 ms)  1'310 ms  1'314 ms  1'314 ms
Node API: Current          888 ms/iter       (842 ms … 922 ms)    917 ms    922 ms    922 ms

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

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     140 ms/iter       (139 ms … 141 ms)    141 ms    141 ms    141 ms
Web Assembly: Latest       182 ms/iter       (180 ms … 185 ms)    182 ms    185 ms    185 ms
Web Assembly: Current      181 ms/iter       (180 ms … 182 ms)    181 ms    182 ms    182 ms
Node API: Current          106 ms/iter       (105 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.71x slower than Node API: Current
   1.29x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'035 µs/iter     (978 µs … 1'692 µs)  1'030 µs  1'574 µs  1'692 µs
Web Assembly: Latest     1'454 µs/iter   (1'299 µs … 2'575 µs)  1'402 µs  2'529 µs  2'575 µs
Web Assembly: Current    1'356 µs/iter   (1'301 µs … 1'947 µs)  1'359 µs  1'747 µs  1'947 µs
Node API: Current          764 µs/iter       (711 µs … 945 µs)    790 µs    841 µs    945 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'041 µs/iter     (985 µs … 1'710 µs)  1'034 µs  1'639 µs  1'710 µs
Web Assembly: Latest     1'356 µs/iter   (1'301 µs … 1'776 µs)  1'361 µs  1'704 µs  1'776 µs
Web Assembly: Current    1'383 µs/iter   (1'323 µs … 2'241 µs)  1'377 µs  2'115 µs  2'241 µs
Node API: Current          772 µs/iter     (713 µs … 1'036 µs)    806 µs    851 µs  1'036 µs

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

After changes in 46637e0a74095423952bcf08ffae3382b6e620a6

github-actions[bot] avatar Apr 10 '24 18:04 github-actions[bot]