idea-php-laravel-plugin
idea-php-laravel-plugin copied to clipboard
[performance-problem] PhpTemplateUsageStubIndex traverse the whole tree
The indexer in PhpTemplateUsageStubIndex
is not optimized and uses PsiRecursiveElementWalkingVisitor
to traverse the whole tree visiting each Psi Element.
As a result on the indexing time of https://github.com/laravelio/portal increases from 140s to 170s.
The following code may be used to visit methods:
for (PhpNamedElement element : ((PhpFile)psiFile).getTopLevelDefs().values()) {
if (element instanceof PhpClass) {
for (Method method : ((PhpClass)element).getOwnMethods()) {
...
and the following
for (PhpNamedElement element : ((PhpFile)psiFile).getTopLevelDefs().values()) {
if (element instanceof Function) {
to visit functions.