Improve dokka performance (documentable model generation)
owengray-google opened this issue · comments
With the recent re-architecture, generating documentable model
was made single-threaded. This poses a major performance regression for us, of at least 100% runtime.
There also appear to be some low-handing fruit for performance improvements for that step:
- 8% of our runtime is in
DokkaDescriptorVisitor.getDescriptorsWithKind-> filterDescriptorsInSourceSet -> UnixPath.toRealPath
. I'm not sure toRealPath is even necessary? - 8-18% of our runtime is in
DokkaDescriptorVisitor.toBound() -> kotlin.types.WrappedType.getConstructor()
; I suspect if nothing else types are often reused and something here could be cached. - 1-6.4% of our runtime is in
psi.KtFile.getPackageDirectiveByTree
; this feels like it could be cached or use a heuristic. This seems to be much worse on KMP inputs. - 1-3% of our runtime is
transformDocumentationModelBeforeMerge
, mostly in filters you provide; I hope some of these filters or their invocations could be merged or something? This seems to be much worse on KMP inputs. org.jetbrains.kotlin.resolve.FunctionDescriptorResolver.createValueParameterDescriptors
is taking much more time than I would expect. It seems like this should be cacheable? I would expect many value classes to be reused.- 3-7.5% of total runtime is
getHierarchicalMethodSignature
. This seems to be much worse on KMP inputs.