Is there any possibility that KSP2 performance can...
# ksp
e
Is there any possibility that KSP2 performance can eventually match the performance of KSP1?
e
@Brad Corso circling back here finally, sorry I didn't get a profile to you before, but I'll DM it to you today. I wanted to share that I was keeping an eye on ksp commits/releases for performance work, and it looked like 2.3.8 had some perf improvements that might help us, but I benchmarked that version and it has no improvement for us, so our perf issues lie elsewhere.
b
but I benchmarked that version and it has no improvement for us
Note that the improvements are behind a flag (
experimentalPsiResolution
)
@eygraber yes, I think it's possible. I wasn't very involved with KSP1 but my understanding was that it worked directly with PsiElement representation. KSP2 switched to using Kotlinc's Analysis API (AA) which was supposed to be less error-prone but we've recently found that it's not granular enough and ends up over-resolving (or sometimes just has performance bugs). The new approach we're taking with
experimentalPsiResolution
is kind of a mix, where we use the
PsiElement
layer for simple things and then delegate to the AA for more complex things like type resolution. This approach should allow us to get the best of both approaches.
thank you color 2
e
Note that the improvements are behind a flag
ah, thanks. I'll try benchmarking with that. Any reason not to call out that flag in the release notes?
I did benchmarks with the
experimentalPsiResolution
enabled, and unfortunately it still didn't help in our case (With gradle, it can be enabled via a gradle property, eg from command line
-Pksp.experimental.psi.resolution=true
) I believe my profiling shows that our hotspots are elsewhere, so optimizing getSymbolsWithAnnotation didn't help with our particular build