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

experiment: custom value serializer #4928

Closed
wants to merge 9 commits into from
Closed

Conversation

Weakky
Copy link
Member

@Weakky Weakky commented Jun 19, 2024

Overview

related issue: https://github.com/prisma/team-orm/issues/1141

experiment to improve query raw perf

To profile the query engine, you can build/run an example binary: cargo build --profile profiling --example repro

To seed the postgres database, have a look at https://github.com/prisma/query-benchmarks's README

Improvements seen so far:

Before

cpu: Apple M1 Max
runtime: node v18.17.1 (arm64-darwin)

benchmark               time (avg)             (min … max)       p75       p99      p999
---------------------------------------------------------- -----------------------------
• SELECT * FROM "Movie" (50000)
---------------------------------------------------------- -----------------------------
PG                     116 ms/iter       (111 ms … 121 ms)    119 ms    121 ms    121 ms
Prisma Rust (Napi)     457 ms/iter       (447 ms … 467 ms)    466 ms    467 ms    467 ms

summary for SELECT * FROM "Movie" (50000)
  PG
   3.94x faster than Prisma Rust (Napi)

After (direct serialization)

cpu: Apple M1 Max
runtime: node v18.17.1 (arm64-darwin)

benchmark               time (avg)             (min … max)       p75       p99      p999
---------------------------------------------------------- -----------------------------
• SELECT * FROM "Movie" (50000)
---------------------------------------------------------- -----------------------------
PG                     113 ms/iter       (112 ms … 116 ms)    115 ms    116 ms    116 ms
Prisma Rust (Napi)     307 ms/iter       (300 ms … 313 ms)    311 ms    313 ms    313 ms

summary for SELECT * FROM "Movie" (50000)
  PG
   2.71x faster than Prisma Rust (Napi)

After (direct serialization + array shape result)

cpu: Apple M1 Max
runtime: node v18.17.1 (arm64-darwin)

benchmark               time (avg)             (min … max)       p75       p99      p999
---------------------------------------------------------- -----------------------------
• SELECT * FROM "Movie" (50000)
---------------------------------------------------------- -----------------------------
PG                     140 ms/iter       (135 ms … 145 ms)    143 ms    145 ms    145 ms
Prisma Rust (Napi)     234 ms/iter       (228 ms … 239 ms)    238 ms    239 ms    239 ms

summary for SELECT * FROM "Movie" (50000)
  PG
   1.67x faster than Prisma Rust (Napi)

Copy link
Contributor

github-actions bot commented Jun 19, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.067MiB 2.043MiB 23.893KiB
Postgres (gzip) 824.144KiB 814.515KiB 9.629KiB
Mysql 2.035MiB 2.013MiB 22.292KiB
Mysql (gzip) 810.472KiB 801.075KiB 9.398KiB
Sqlite 1.933MiB 1.914MiB 18.900KiB
Sqlite (gzip) 771.105KiB 763.375KiB 7.730KiB

@Weakky Weakky force-pushed the perf/custom-value-serializer branch from 4072149 to fa92bb4 Compare June 24, 2024 11:04
Copy link

codspeed-hq bot commented Jun 24, 2024

CodSpeed Performance Report

Merging #4928 will not alter performance

Comparing perf/custom-value-serializer (3670da3) with main (d56fe2e)

Summary

✅ 11 untouched benchmarks

@Weakky Weakky closed this Jul 17, 2024
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.

1 participant