K
Kysely5d 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
4 Replies
Solution
koskimas
koskimas4d 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
bombillazo4d ago
So is the performance more on the development? like TypeScript trying to consolidate the types? Or is it runtime performance impact?
koskimas
koskimas3d 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
dmtOP3d ago
I see, that's great news! Thanks for quickly answering my question!

Did you find this page helpful?