Open yigit opened 2 years ago
So I've implemented relatively better measurements in room.
The changes in that CL can improve resolveUserType
performance by 20% (and force resolve performance by 80%) but all things considered, it only comes to a 3-4% overall improvement in room (better than nothing but not super effective either).
There is still some unaccounted time for which I need to add more metrics around to better understand this.
I also noticed that the difference is more significant when daemon is not used, which is what i was using to attach the profiler but should stop doing that (e.g. resolveUserType gets 30% faster with fresh compiler vs only 20% faster with a daemon).
I've been running some profiling with KSP and Room.
This is a tracking issue to log some findings. I'll try to turn some of these findings into PRs but I thought it would be good to share some findings here.
When I profile Room we spend significant time in
resolveType
, which does in fact make sense.There a couple options to improve performance there:
Don't force resolve containing type This commonly happens in annotations where, to resolve the type of the annotation, we call ForceResolve on its container which ends up force resolving the annotated element. e.g. when it is a class, it means resolving everything on that class. There is a already a TODO there to avoid this and after taking some measurements in Room, this seems to help around ~30% for Room (it is 30% time in resolving types, not necessarily the whole processing)
Consider caching validations Now i'm not 100% sure on this one but the excessive validation in XProcessing is around ~30% of Room's total time spent in processing. I've not dig deeper to see if this is just upfront cost for visiting an element or if we could save real time. Need to investigate further. But we may as well be validating elements that we wouldn't visit otherwise. Furthermore, validation results are not cached in KSP. It may not matter as most of that cost is not traversal but type resolution (which is cached) but could possibly have an impact.
I'll try to keep this issue updated as I have time to do further measurements. Just wanted to get this log started.