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
Jessielaf
Jessielaf2y ago
We have the same error. It is not only applicable to intellisense on the drizzle database but on everything.
Md Jahidul Islam milon
i am specially facing on drizzle. other projects working fine, also tried the prisma ,thats also working fine
Cayter
Cayter2y ago
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 scale
Andrii Sherman
We 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
code9
code95mo ago
is there any update on this? it seems to still be an issue on 0.32
Andrii Sherman
Andrii Sherman5mo ago
it was fixed a year ago do you still have this issue?
Gabriel
Gabriel5mo ago
I love you Andrew Sherman
code9
code95mo ago
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)
Gabriel
Gabriel5mo ago
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:
export const schema = {
…user
…team
…apps
}
export const schema = {
…user
…team
…apps
}
Became:
export * from “./user”
export * from “./apps”
export * from “./team”
export * from “./user”
export * from “./apps”
export * from “./team”
This improved the performance a lot for me
code9
code95mo ago
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" ??
rphlmr ⚡
rphlmr ⚡5mo ago
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.
Gabriel
Gabriel5mo ago
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
rphlmr ⚡
rphlmr ⚡5mo ago
Good idea!
Andrii Sherman
Andrii Sherman5mo ago
we would need to test it as well, and maybe we can do something to actually fix it for both approaches
Want results from more Discord servers?
Add your server