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: update rust and wasm-bindgen #4867

Merged
merged 4 commits into from May 13, 2024
Merged

chore: update rust and wasm-bindgen #4867

merged 4 commits into from May 13, 2024

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented May 10, 2024

This PR reverts the Rust downgrade and upgrades it back to 1.78. The panic which happens with newer Rust and dlmalloc is expected and catches a bug in the wasm-bindgen version that we used. Thus wasm-bindgen is also upgraded from 0.2.89 to 0.2.92.

Client tests: https://github.com/prisma/prisma/actions/runs/9038431815?pr=24154

Reverts: #4865
Ref: rustwasm/wasm-bindgen#3801
Ref: alexcrichton/dlmalloc-rs#32

@aqrln aqrln requested a review from a team as a code owner May 10, 2024 20:30
@aqrln aqrln requested review from Druue and removed request for a team May 10, 2024 20:30
Copy link

codspeed-hq bot commented May 10, 2024

CodSpeed Performance Report

Merging #4867 will degrade performances by 13.51%

Comparing integration/rust-1.78-wasm (fc92622) with main (6eec160)

Summary

❌ 3 regressions
✅ 8 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main integration/rust-1.78-wasm Change
validate (large) 310 ms 358.4 ms -13.51%
validate (medium) 67.7 ms 77.9 ms -13.06%
validate (small) 9.5 ms 11 ms -13.13%

Copy link
Contributor

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.153MiB 2.152MiB 214.000B
Postgres (gzip) 846.111KiB 845.853KiB 264.000B
Mysql 2.121MiB 2.123MiB -1.748KiB
Mysql (gzip) 832.562KiB 832.879KiB -325.000B
Sqlite 2.015MiB 2.016MiB -513.000B
Sqlite (gzip) 793.469KiB 793.209KiB 267.000B

Copy link
Contributor

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

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     359 ms/iter       (358 ms … 362 ms)    360 ms    362 ms    362 ms
Web Assembly: Latest       445 ms/iter       (444 ms … 447 ms)    446 ms    447 ms    447 ms
Web Assembly: Current      451 ms/iter       (449 ms … 454 ms)    452 ms    454 ms    454 ms
Node API: Current          199 ms/iter       (193 ms … 209 ms)    205 ms    209 ms    209 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'702 µs/iter (14'543 µs … 17'637 µs) 14'650 µs 17'637 µs 17'637 µs
Web Assembly: Latest    18'219 µs/iter (18'048 µs … 18'686 µs) 18'243 µs 18'686 µs 18'686 µs
Web Assembly: Current   18'355 µs/iter (18'167 µs … 19'315 µs) 18'374 µs 19'315 µs 19'315 µs
Node API: Current        8'017 µs/iter   (7'911 µs … 8'327 µs)  8'053 µs  8'327 µs  8'327 µs

summary for movies.findMany({ take: 2000 })
  Web Assembly: Current
   2.29x 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'287 µs/iter   (2'159 µs … 3'539 µs)  2'263 µs  3'383 µs  3'539 µs
Web Assembly: Latest     2'999 µs/iter   (2'766 µs … 5'495 µs)  2'890 µs  5'483 µs  5'495 µs
Web Assembly: Current    2'853 µs/iter   (2'781 µs … 3'168 µs)  2'857 µs  3'112 µs  3'168 µs
Node API: Current        1'394 µs/iter   (1'332 µs … 1'640 µs)  1'402 µs  1'583 µs  1'640 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     556 ms/iter       (548 ms … 575 ms)    563 ms    575 ms    575 ms
Web Assembly: Latest       772 ms/iter       (764 ms … 787 ms)    776 ms    787 ms    787 ms
Web Assembly: Current      778 ms/iter       (772 ms … 795 ms)    784 ms    795 ms    795 ms
Node API: Current          466 ms/iter       (459 ms … 481 ms)    470 ms    481 ms    481 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  77'793 µs/iter (76'909 µs … 79'964 µs) 79'475 µs 79'964 µs 79'964 µs
Web Assembly: Latest       108 ms/iter       (108 ms … 108 ms)    108 ms    108 ms    108 ms
Web Assembly: Current      110 ms/iter       (109 ms … 115 ms)    110 ms    115 ms    115 ms
Node API: Current       60'651 µs/iter (59'962 µs … 61'282 µs) 61'215 µs 61'282 µs 61'282 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     998 ms/iter     (990 ms … 1'017 ms)  1'006 ms  1'017 ms  1'017 ms
Web Assembly: Latest     1'283 ms/iter   (1'273 ms … 1'301 ms)  1'291 ms  1'301 ms  1'301 ms
Web Assembly: Current    1'304 ms/iter   (1'293 ms … 1'320 ms)  1'314 ms  1'320 ms  1'320 ms
Node API: Current          867 ms/iter       (832 ms … 909 ms)    901 ms    909 ms    909 ms

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

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     142 ms/iter       (139 ms … 146 ms)    145 ms    146 ms    146 ms
Web Assembly: Latest       179 ms/iter       (178 ms … 181 ms)    180 ms    181 ms    181 ms
Web Assembly: Current      181 ms/iter       (180 ms … 183 ms)    181 ms    183 ms    183 ms
Node API: Current          105 ms/iter       (104 ms … 108 ms)    106 ms    108 ms    108 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.72x slower than Node API: Current
   1.28x 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'039 µs/iter     (969 µs … 1'823 µs)  1'030 µs  1'607 µs  1'823 µs
Web Assembly: Latest     1'420 µs/iter   (1'292 µs … 2'598 µs)  1'373 µs  2'516 µs  2'598 µs
Web Assembly: Current    1'381 µs/iter   (1'310 µs … 2'178 µs)  1'378 µs  1'763 µs  2'178 µs
Node API: Current          789 µs/iter     (739 µs … 1'004 µs)    799 µs    830 µs  1'004 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'027 µs/iter     (975 µs … 1'722 µs)  1'026 µs  1'430 µs  1'722 µs
Web Assembly: Latest     1'336 µs/iter   (1'289 µs … 1'945 µs)  1'343 µs  1'651 µs  1'945 µs
Web Assembly: Current    1'369 µs/iter   (1'310 µs … 1'846 µs)  1'373 µs  1'734 µs  1'846 µs
Node API: Current          792 µs/iter       (754 µs … 994 µs)    803 µs    838 µs    994 µs

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

After changes in fc92622

@aqrln aqrln added this to the 5.14.0 milestone May 10, 2024
@SevInf SevInf merged commit 079da82 into main May 13, 2024
211 of 212 checks passed
@SevInf SevInf deleted the integration/rust-1.78-wasm branch May 13, 2024 07:47
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

2 participants