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

query-engine-c-abi: Fix build warnings after update #4864

Merged
merged 1 commit into from May 10, 2024
Merged

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented May 10, 2024

rustc now detects unused trait methods, which means we need to make a
new offering to the gods of cfg[feature=].

`rustc` now detects unused trait methods, which means we need to make a
new offering to the gods of `cfg[feature=]`.
@SevInf SevInf requested a review from a team as a code owner May 10, 2024 12:19
@SevInf SevInf added this to the 5.14.0 milestone May 10, 2024
@SevInf SevInf requested review from laplab and removed request for a team May 10, 2024 12:19
Copy link

codspeed-hq bot commented May 10, 2024

CodSpeed Performance Report

Merging #4864 will not alter performance

Comparing fix/rn-build (4dab8ff) with main (e162a52)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.152MiB 2.152MiB 0.000B
Postgres (gzip) 845.855KiB 845.856KiB -1.000B
Mysql 2.123MiB 2.123MiB 0.000B
Mysql (gzip) 832.879KiB 832.881KiB -2.000B
Sqlite 2.016MiB 2.016MiB 0.000B
Sqlite (gzip) 793.209KiB 793.209KiB -1.000B

Copy link
Contributor

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

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     375 ms/iter       (373 ms … 379 ms)    378 ms    379 ms    379 ms
Web Assembly: Latest       462 ms/iter       (457 ms … 469 ms)    465 ms    469 ms    469 ms
Web Assembly: Current      456 ms/iter       (454 ms … 461 ms)    458 ms    461 ms    461 ms
Node API: Current          199 ms/iter       (198 ms … 205 ms)    200 ms    205 ms    205 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  15'172 µs/iter (14'812 µs … 17'875 µs) 15'240 µs 17'875 µs 17'875 µs
Web Assembly: Latest    18'511 µs/iter (18'278 µs … 19'088 µs) 18'636 µs 19'088 µs 19'088 µs
Web Assembly: Current   18'659 µs/iter (18'218 µs … 20'497 µs) 18'718 µs 20'497 µs 20'497 µs
Node API: Current        8'158 µs/iter   (8'033 µs … 8'538 µs)  8'223 µs  8'538 µs  8'538 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'395 µs/iter   (2'240 µs … 3'737 µs)  2'392 µs  3'430 µs  3'737 µs
Web Assembly: Latest     2'934 µs/iter   (2'783 µs … 4'666 µs)  2'892 µs  3'807 µs  4'666 µs
Web Assembly: Current    2'876 µs/iter   (2'775 µs … 4'682 µs)  2'861 µs  3'612 µs  4'682 µs
Node API: Current        1'451 µs/iter   (1'314 µs … 2'348 µs)  1'440 µs  1'999 µs  2'348 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     571 ms/iter       (565 ms … 594 ms)    571 ms    594 ms    594 ms
Web Assembly: Latest       772 ms/iter       (768 ms … 779 ms)    775 ms    779 ms    779 ms
Web Assembly: Current      777 ms/iter       (774 ms … 779 ms)    778 ms    779 ms    779 ms
Node API: Current          483 ms/iter       (466 ms … 501 ms)    499 ms    501 ms    501 ms

summary for movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.61x slower than Node API: Current
   1.36x 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'595 µs/iter (78'019 µs … 79'475 µs) 79'262 µs 79'475 µs 79'475 µs
Web Assembly: Latest       110 ms/iter       (108 ms … 111 ms)    111 ms    111 ms    111 ms
Web Assembly: Current      110 ms/iter       (109 ms … 111 ms)    110 ms    111 ms    111 ms
Node API: Current       64'281 µs/iter (62'593 µs … 66'607 µs) 66'239 µs 66'607 µs 66'607 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'010 ms/iter   (1'001 ms … 1'034 ms)  1'014 ms  1'034 ms  1'034 ms
Web Assembly: Latest     1'302 ms/iter   (1'291 ms … 1'317 ms)  1'316 ms  1'317 ms  1'317 ms
Web Assembly: Current    1'302 ms/iter   (1'294 ms … 1'317 ms)  1'307 ms  1'317 ms  1'317 ms
Node API: Current          899 ms/iter       (881 ms … 925 ms)    913 ms    925 ms    925 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.45x 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     144 ms/iter       (141 ms … 146 ms)    145 ms    146 ms    146 ms
Web Assembly: Latest       184 ms/iter       (180 ms … 186 ms)    186 ms    186 ms    186 ms
Web Assembly: Current      185 ms/iter       (183 ms … 187 ms)    186 ms    187 ms    187 ms
Node API: Current          114 ms/iter       (111 ms … 117 ms)    116 ms    117 ms    117 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.62x 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'074 µs/iter   (1'014 µs … 1'686 µs)  1'074 µs  1'511 µs  1'686 µs
Web Assembly: Latest     1'380 µs/iter   (1'297 µs … 2'193 µs)  1'376 µs  2'083 µs  2'193 µs
Web Assembly: Current    1'380 µs/iter   (1'307 µs … 2'158 µs)  1'381 µs  1'815 µs  2'158 µs
Node API: Current          788 µs/iter     (718 µs … 1'136 µs)    804 µs    848 µs  1'136 µ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.28x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'042 µs/iter     (995 µs … 1'706 µs)  1'048 µs  1'381 µs  1'706 µs
Web Assembly: Latest     1'376 µs/iter   (1'306 µs … 2'037 µs)  1'379 µs  1'801 µs  2'037 µs
Web Assembly: Current    1'382 µs/iter   (1'312 µs … 2'166 µs)  1'380 µs  2'053 µs  2'166 µs
Node API: Current          775 µs/iter     (720 µs … 1'082 µs)    804 µs    848 µs  1'082 µs

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

After changes in 4dab8ff

@@ -82,6 +82,7 @@ impl TypeIdentifier for Column<'_> {
)
}

#[cfg(feature = "mysql")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels really weird that a mysql feature is in sqlite; am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think TypeIdentifier is used only by sqlite and mysql. So, if mysql is enabled, method in trait will exist and that will force us to implement one for sqlite too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but we also have the same file for mysql. That feels like it'd make more sense for us to tag this one as feature = "sqlite" and then add the same fn over in the mysql connector

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the build where sqlite and mysql are always included.

Situation is:

  • if mysql is not enabled than TypeIdentifier will not have is_json method and it all will be good
  • If sqlite is not enabled, all methods are used and there will be no warnings.
  • If mysql is enabled, is_json method will be added to trait and since sqlite and mysql share the trait we'll be forced to implement it for sqlite as well.

@SevInf
Copy link
Contributor Author

SevInf commented May 10, 2024

I am gonna merge it since i need a RN release, but fell free to continue the discussion, if any changes are needed, I'll open a follow up PR

@SevInf SevInf merged commit b046ee1 into main May 10, 2024
208 checks passed
@SevInf SevInf deleted the fix/rn-build branch May 10, 2024 13:45
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