idea-php-laravel-plugin icon indicating copy to clipboard operation
idea-php-laravel-plugin copied to clipboard

[performance-problem] PhpTemplateUsageStubIndex traverse the whole tree

Open MaXal opened this issue 6 years ago • 0 comments

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.

MaXal avatar Nov 29 '18 14:11 MaXal