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

feat(quaint): investigate sqlite connection #4872

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented May 16, 2024

Comments and changes inspired from prisma/prisma#10403.

Copy link

codspeed-hq bot commented May 16, 2024

CodSpeed Performance Report

Merging #4872 will not alter performance

Comparing feat/investigate-sqlite-connection (62b5078) with main (89e2d89)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 16, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.152MiB 2.152MiB 0.000B
Postgres (gzip) 845.829KiB 845.829KiB 0.000B
Mysql 2.119MiB 2.119MiB 0.000B
Mysql (gzip) 831.748KiB 831.747KiB 1.000B
Sqlite 2.017MiB 2.015MiB 1.869KiB
Sqlite (gzip) 793.877KiB 793.155KiB 740.000B

Copy link
Contributor

github-actions bot commented May 16, 2024

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

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     360 ms/iter       (359 ms … 362 ms)    361 ms    362 ms    362 ms
Web Assembly: Latest       456 ms/iter       (451 ms … 463 ms)    462 ms    463 ms    463 ms
Web Assembly: Current      454 ms/iter       (450 ms … 464 ms)    456 ms    464 ms    464 ms
Node API: Current          199 ms/iter       (197 ms … 205 ms)    200 ms    205 ms    205 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'737 µs/iter (14'588 µs … 15'670 µs) 14'766 µs 15'670 µs 15'670 µs
Web Assembly: Latest    18'344 µs/iter (18'211 µs … 18'563 µs) 18'414 µs 18'563 µs 18'563 µs
Web Assembly: Current   18'312 µs/iter (18'147 µs … 19'205 µs) 18'311 µs 19'205 µs 19'205 µs
Node API: Current        8'028 µs/iter   (7'864 µs … 8'354 µs)  8'048 µs  8'354 µs  8'354 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'301 µs/iter   (2'202 µs … 3'216 µs)  2'312 µs  2'964 µs  3'216 µs
Web Assembly: Latest     2'881 µs/iter   (2'782 µs … 3'723 µs)  2'869 µs  3'590 µs  3'723 µs
Web Assembly: Current    2'890 µs/iter   (2'783 µs … 4'826 µs)  2'868 µs  3'735 µs  4'826 µs
Node API: Current        1'426 µs/iter   (1'346 µs … 1'750 µs)  1'430 µs  1'676 µs  1'750 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     564 ms/iter       (556 ms … 578 ms)    567 ms    578 ms    578 ms
Web Assembly: Latest       775 ms/iter       (769 ms … 787 ms)    779 ms    787 ms    787 ms
Web Assembly: Current      781 ms/iter       (774 ms … 800 ms)    785 ms    800 ms    800 ms
Node API: Current          470 ms/iter       (454 ms … 480 ms)    477 ms    480 ms    480 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  78'384 µs/iter (77'803 µs … 78'819 µs) 78'658 µs 78'819 µs 78'819 µs
Web Assembly: Latest       110 ms/iter       (109 ms … 111 ms)    110 ms    111 ms    111 ms
Web Assembly: Current      109 ms/iter       (109 ms … 110 ms)    110 ms    110 ms    110 ms
Node API: Current       60'693 µs/iter (59'890 µs … 61'473 µs) 61'395 µs 61'473 µs 61'473 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'003 ms/iter     (996 ms … 1'016 ms)  1'004 ms  1'016 ms  1'016 ms
Web Assembly: Latest     1'300 ms/iter   (1'288 ms … 1'322 ms)  1'310 ms  1'322 ms  1'322 ms
Web Assembly: Current    1'305 ms/iter   (1'294 ms … 1'334 ms)  1'320 ms  1'334 ms  1'334 ms
Node API: Current          874 ms/iter       (850 ms … 901 ms)    895 ms    901 ms    901 ms

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

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     141 ms/iter       (140 ms … 143 ms)    141 ms    143 ms    143 ms
Web Assembly: Latest       180 ms/iter       (179 ms … 180 ms)    180 ms    180 ms    180 ms
Web Assembly: Current      181 ms/iter       (181 ms … 182 ms)    181 ms    182 ms    182 ms
Node API: Current          105 ms/iter       (103 ms … 107 ms)    107 ms    107 ms    107 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.72x slower than Node API: Current
   1.29x 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'033 µs/iter     (978 µs … 1'712 µs)  1'029 µs  1'511 µs  1'712 µs
Web Assembly: Latest     1'393 µs/iter   (1'327 µs … 2'214 µs)  1'384 µs  1'896 µs  2'214 µs
Web Assembly: Current    1'427 µs/iter   (1'336 µs … 2'393 µs)  1'407 µs  2'206 µs  2'393 µs
Node API: Current          777 µs/iter     (713 µs … 1'185 µs)    795 µs    930 µs  1'185 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'025 µs/iter     (981 µs … 1'690 µs)  1'027 µs  1'598 µs  1'690 µs
Web Assembly: Latest     1'372 µs/iter   (1'312 µs … 1'937 µs)  1'374 µs  1'765 µs  1'937 µs
Web Assembly: Current    1'366 µs/iter   (1'315 µs … 1'974 µs)  1'372 µs  1'689 µs  1'974 µs
Node API: Current          778 µs/iter     (716 µs … 1'184 µs)    795 µs    857 µs  1'184 µ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
   1x faster than Web Assembly: Latest

After changes in 62b5078

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

1 participant