K
Kysely2mo ago
dmt

Performance impact of "$if" ?

According to the documentation, $if "has an impact on typescript performance and it should only be used when necessary". I would like to use it for conditional selects. How bad is the performance impact? Thanks in advance!
Solution:
It's impossible to predict. But if you start seeing long pauses before you get intellisense, try to reduce the $if calls to see if it helps. The impact is much smaller now than it was when I wrote that doc.
Jump to solution
5 Replies
Solution
koskimas
koskimas2mo ago
It's impossible to predict. But if you start seeing long pauses before you get intellisense, try to reduce the $if calls to see if it helps. The impact is much smaller now than it was when I wrote that doc.
bombillazo
bombillazo2mo ago
So is the performance more on the development? like TypeScript trying to consolidate the types? Or is it runtime performance impact?
koskimas
koskimas2mo ago
Of course only on development. Only on IDE intellisense. How could that function affect runtime performance? Kysely only builds SQL strings. Nothing you do to build a SQL string can ever take a meaningful time.
dmt
dmtOP2mo ago
I see, that's great news! Thanks for quickly answering my question!
bombillazo
bombillazo2mo ago
pardon my ignorance, you're right hehe

Did you find this page helpful?