This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 193040 - Slow code completion when complete constructors
Summary: Slow code completion when complete constructors
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords: PERFORMANCE
: 197267 (view as bug list)
Depends on:
Blocks: 189889
  Show dependency tree
 
Reported: 2010-12-08 10:18 UTC by Petr Pisl
Modified: 2011-03-31 09:51 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2010-12-08 10:18:42 UTC
This is a comment from issue #189889:

Apparently, there are different bottlenecks that cause this performance
problem. But I think one of them makes the most noticeable slowdown. Here is
how you can reproduce a situation where this bottleneck shows itself:

1. Put Zend Framework library in your project's include_path config in
netbeans.

2. Your project will be a simple php file that tries to instantiate a ZF class
like Zend_Db_Table_Row_Abstract.

3. Start typing:
$row = new Zend_Db_Table_Row();

>> as you may have noticed, it's only one line of code, and none of the framework files are changed, cause they are just in the include path, but yet, the code completion is really slow and we are still better off typing the class name manually.

What this tells us, is that even if the problems like duplicate sources and
models taking too long to be built didn't exist, the code completion would
still be really slow.

Can anyone tell us what happens (overally) when the developer types in $var =
new Zend_ and then hits space? I mean, suppose all the files in the project are
fully parsed and all the models are built, and we are just typing in an empty
file; what functions are called when netbeans tries to give the user a list of
suggestions for the auto complete?
Comment 1 Petr Pisl 2010-12-08 10:19:02 UTC
This is good usecase. Thanks cgalive. 

So what happens? Basically when you write  new Zend_ , then the ide looks for
all constructors that can starts with Zend_ . The counting constructors is
slow, because the constructor doesn't have to be declared in the class, but in
an extend class, which doesn't have to starts with Zend_ . So basically the
algorithm is in pseudo language:

1. give me all classes that starts with Zend_
2. for every founded class
3.     If has a constructor continue
4.     If doesn't have a constructor, try to find recursively constructor in
extended class until a constructor will not be find

Because there is many classes that starts with Zend_ the algorithm is slow. So
I think the fix for this case, can be that the code completion will suggest in
this case just name of classes and when a user choose a class, then the
constructor is counted just for the selected class. The disadvantage of this is
that you will not see parameters of constructor. Do you agree with this
solution
Comment 2 Petr Pisl 2010-12-08 11:07:42 UTC
Fixed in web main.
Comment 3 Quality Engineering 2010-12-09 06:18:48 UTC
Integrated into 'main-golden', will be available in build *201012090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/43e6b7b78866
User: Petr Pisl <ppisl@netbeans.org>
Log: #193040 - Slow code completion when complete constructor
Comment 4 Petr Pisl 2010-12-09 15:21:32 UTC
*** Bug 192775 has been marked as a duplicate of this bug. ***
Comment 5 Petr Pisl 2011-03-31 09:51:55 UTC
*** Bug 197267 has been marked as a duplicate of this bug. ***