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

Support multiple files in text-document completions and code actions #4862

Merged
merged 9 commits into from May 15, 2024

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented May 10, 2024

You should know the drill for now: instead of a single schema text, we accept a list of (name, content) tuples, adapt the rest of the code to use *_multi methods and point the edits to the correct files.

Notable changes here are done to the test setups:

For completions, several prisma files could be put into the test directory. Only one of them suppsed to have cursor marker - that file will be used as a target for completion request, rest of the files will be used for building up the schema.

For code actions, several files in prisma directory are supported. In case more than one file is found, one of the files is expected to be named _target.prisma and it will be used as a target for code action request.

Other changes in this PR include accepting slices rather than vectors in several *_multi method to avoid unnecessary cloning.

Close prisma/team-orm#1041

@SevInf SevInf requested a review from a team as a code owner May 10, 2024 09:23
@SevInf SevInf added this to the 5.14.0 milestone May 10, 2024
@SevInf SevInf requested review from Druue and removed request for a team May 10, 2024 09:23
@SevInf SevInf marked this pull request as draft May 10, 2024 09:23
@janpio janpio changed the title [WIP]: Support multiple files in text-document completeions and code actions [WIP]: Support multiple files in text-document completions and code actions May 10, 2024
@SevInf SevInf force-pushed the text-comp-multi branch 2 times, most recently from 5bc901e to f684c71 Compare May 10, 2024 16:11
Copy link

codspeed-hq bot commented May 10, 2024

CodSpeed Performance Report

Merging #4862 will not alter performance

Comparing text-comp-multi (585d249) with main (e9771e6)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 10, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.152MiB 2.153MiB -146.000B
Postgres (gzip) 845.830KiB 846.109KiB -286.000B
Mysql 2.121MiB 2.121MiB -162.000B
Mysql (gzip) 832.460KiB 832.561KiB -103.000B
Sqlite 2.015MiB 2.015MiB -156.000B
Sqlite (gzip) 793.155KiB 793.468KiB -321.000B

Copy link
Contributor

github-actions bot commented May 10, 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     372 ms/iter       (367 ms … 378 ms)    376 ms    378 ms    378 ms
Web Assembly: Latest       461 ms/iter       (459 ms … 465 ms)    464 ms    465 ms    465 ms
Web Assembly: Current      455 ms/iter       (454 ms … 459 ms)    456 ms    459 ms    459 ms
Node API: Current          197 ms/iter       (195 ms … 198 ms)    198 ms    198 ms    198 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.32x 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'020 µs/iter (14'748 µs … 17'689 µs) 15'011 µs 17'689 µs 17'689 µs
Web Assembly: Latest    18'524 µs/iter (18'270 µs … 19'660 µs) 18'558 µs 19'660 µs 19'660 µs
Web Assembly: Current   18'807 µs/iter (18'325 µs … 20'039 µs) 18'923 µs 20'039 µs 20'039 µs
Node API: Current        8'060 µs/iter   (7'878 µs … 8'443 µs)  8'144 µs  8'443 µs  8'443 µs

summary for movies.findMany({ take: 2000 })
  Web Assembly: Current
   2.33x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1.02x slower than Web Assembly: Latest

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'335 µs/iter   (2'205 µs … 3'798 µs)  2'305 µs  3'428 µs  3'798 µs
Web Assembly: Latest     2'888 µs/iter   (2'776 µs … 4'075 µs)  2'872 µs  3'581 µs  4'075 µs
Web Assembly: Current    2'956 µs/iter   (2'762 µs … 5'304 µs)  2'865 µs  4'868 µs  5'304 µs
Node API: Current        1'437 µs/iter   (1'329 µs … 1'842 µs)  1'438 µs  1'812 µs  1'842 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     578 ms/iter       (571 ms … 597 ms)    582 ms    597 ms    597 ms
Web Assembly: Latest       782 ms/iter       (776 ms … 798 ms)    791 ms    798 ms    798 ms
Web Assembly: Current      784 ms/iter       (776 ms … 805 ms)    804 ms    805 ms    805 ms
Node API: Current          482 ms/iter       (470 ms … 501 ms)    497 ms    501 ms    501 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  79'537 µs/iter (78'618 µs … 80'819 µs) 80'478 µs 80'819 µs 80'819 µs
Web Assembly: Latest       111 ms/iter       (109 ms … 114 ms)    111 ms    114 ms    114 ms
Web Assembly: Current      110 ms/iter       (109 ms … 112 ms)    112 ms    112 ms    112 ms
Node API: Current       62'239 µs/iter (61'384 µs … 63'188 µs) 62'935 µs 63'188 µs 63'188 µs

summary for movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.77x 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'014 ms/iter   (1'007 ms … 1'023 ms)  1'018 ms  1'023 ms  1'023 ms
Web Assembly: Latest     1'305 ms/iter   (1'293 ms … 1'332 ms)  1'316 ms  1'332 ms  1'332 ms
Web Assembly: Current    1'312 ms/iter   (1'302 ms … 1'331 ms)  1'327 ms  1'331 ms  1'331 ms
Node API: Current          885 ms/iter       (852 ms … 907 ms)    906 ms    907 ms    907 ms

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

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     145 ms/iter       (143 ms … 147 ms)    147 ms    147 ms    147 ms
Web Assembly: Latest       184 ms/iter       (182 ms … 185 ms)    185 ms    185 ms    185 ms
Web Assembly: Current      187 ms/iter       (185 ms … 189 ms)    188 ms    189 ms    189 ms
Node API: Current          110 ms/iter       (108 ms … 113 ms)    111 ms    113 ms    113 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.7x 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'041 µs/iter     (977 µs … 1'727 µs)  1'042 µs  1'555 µs  1'727 µs
Web Assembly: Latest     1'392 µs/iter   (1'325 µs … 2'119 µs)  1'388 µs  1'932 µs  2'119 µs
Web Assembly: Current    1'403 µs/iter   (1'303 µs … 2'343 µs)  1'384 µs  2'222 µs  2'343 µs
Node API: Current          765 µs/iter     (696 µs … 1'244 µs)    788 µs    925 µs  1'244 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'025 µs/iter     (977 µs … 1'669 µs)  1'026 µs  1'386 µs  1'669 µs
Web Assembly: Latest     1'392 µs/iter   (1'334 µs … 2'127 µs)  1'392 µs  1'748 µs  2'127 µs
Web Assembly: Current    1'369 µs/iter   (1'303 µs … 1'989 µs)  1'379 µs  1'720 µs  1'989 µs
Node API: Current          770 µs/iter     (703 µs … 1'179 µs)    796 µs    890 µs  1'179 µs

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

After changes in 585d249

@SevInf SevInf marked this pull request as ready for review May 13, 2024 16:29
@SevInf
Copy link
Contributor Author

SevInf commented May 13, 2024

Note: do not merge until 5.14.0 is released, changes need to be done synchronously with language-tools

@SevInf SevInf changed the title [WIP]: Support multiple files in text-document completions and code actions Support multiple files in text-document completions and code actions May 13, 2024
Copy link
Contributor

@Druue Druue left a comment

Choose a reason for hiding this comment

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

Just gonna mark this until after release

@janpio janpio modified the milestones: 5.14.0, 5.15.0 May 13, 2024
Copy link
Contributor

@Druue Druue left a comment

Choose a reason for hiding this comment

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

@SevInf SevInf merged commit 97f638f into main May 15, 2024
207 checks passed
@SevInf SevInf deleted the text-comp-multi branch May 15, 2024 10:18
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

3 participants