Drizzle in vscode Ts Server is very slow
please check the video, when i type something it took around 5-6 seconds to get the auto suggestion. i am on windows and a have attach my processor and ram configuration also. let me know if i am doing anything wrong
14 Replies
We have the same error. It is not only applicable to intellisense on the drizzle database but on everything.
i am specially facing on drizzle. other projects working fine, also tried the prisma ,thats also working fine
there's an issue in the roadmap's backlog
https://github.com/orgs/drizzle-team/projects/1
search for
Decrease the amount of generated TS types (performance issues)
it's been a while and still in backlog, at this point of time, it seems the team's focus is more on going broad to get more users instead of ensuring the existing features work well as our projects scaleWe are aware of this issue, and it's not something that we can fix quickly. We are experimenting with types to make them less complex and help the server function more efficiently.
We are doing it meanwhile implementing new features that we see important for us and for the community
We have a few things to finish in June and needed part of a July will be spent trying to make types smaller
is there any update on this? it seems to still be an issue on 0.32
it was fixed a year ago
do you still have this issue?
I love you Andrew Sherman
Hey @Andrii Sherman thanks for your reply. Yeah we are having this issue, although i cant say "still" since we didnt use drizzle a year ago. Our db has 440 tables. Ive tried setting the "as string" on the field names which reduced the time from over 20 seconds on our slowest machine to a little under 10 secs, but we are aiming for under 2 secs on our slowest machine (16gb m1). Im working now on a script that can split the schema (since we generate schema with drizzle kit, and we dont want to manually manage schema)
Hi @code9 you likely are separating the tables across multiple schema files. How are you constructing the final schema object?
I was using object destructuring before to join all of the schema files and it was resulting in awful ts performance
Eg:
Became:
This improved the performance a lot for me
Im using destructuring indeed, so for passing the schemas to the drizzle client you just do something like
import * as allSchemas from "my-exporting-file"
??That would not be the first time I have TS issues with destructuring complex objects that have deep recursion/proxy/prototype.
It happens to me with custom Remix fetchers that I used to destructure. Stopping that brought the performance back.
Yes that’s exactly how I do it. I’m so glad to find out I’m not the only one that went over this issue. Try to remove destructuring and use this new approach. Please let us know how it goes
@Raphaël M (@rphlmr) ⚡ @Andrew Sherman I believe many more people have this same problem. I believe there should be some place in the documentation explaining how to use the schema across multiple files? I’d be down to file a PR for it
Good idea!
we would need to test it as well, and maybe we can do something to actually fix it for both approaches