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 256837 - Incredible slowness in code completion (even for already retrieved objects)
Summary: Incredible slowness in code completion (even for already retrieved objects)
Status: RESOLVED INCOMPLETE
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P1 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-27 15:09 UTC by antoniocs
Modified: 2016-01-05 15:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Failed dependency (9.25 KB, image/png)
2015-12-04 09:43 UTC, antoniocs
Details
super slow (4.01 KB, image/png)
2015-12-07 17:24 UTC, antoniocs
Details
Profiler output (65.73 KB, application/octet-stream)
2015-12-16 11:38 UTC, antoniocs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description antoniocs 2015-11-27 15:09:50 UTC
Something has to be done about how slow the code completion is. (in my case for PHP projects)
Even for objects that it retrieved methods for, it still takes sometime (not always but sometimes).
I am getting at least 10 to 20 seconds of wait time.

I initially thought it was my machine that was at fault, but now I am on a brand new machine. Here are the details:

CPU: Intel Core i7 4790K
RAM: DDR3 16GB
Storage: SM951 M2 ACHI
OS: Windows 10 pro 64bit

This must be something in the code. Whatever algorithm is used to manage code completion. 
The project I am working on doesn't have that many files, so I don't see why the code completion takes so long.

Please, someone do something about this. I really enjoy netbeans but this issue with the code complete really kills my flow when programming.

If required I will post a video of how slow this is.
Comment 1 Jiri Prox 2015-11-30 13:11:46 UTC
Can you please capture data from profiler and attach it here.
You can use Profile the IDE action (by default Alt-Shift-Y).
Just press the shortcut, perform the long code completion and press the shortcut again. The save the snapshot and attach is here.

We'll evaluate what is taking so long.

Thanks
Comment 2 antoniocs 2015-11-30 14:45:07 UTC
Ok I got a snapshot but how do I view it?

I am trying to see what data I am posting on a public site so I really want to see what this snapshot contains. Any clues as where I can see this?
Comment 3 antoniocs 2015-12-04 09:43:03 UTC
Created attachment 157662 [details]
Failed dependency
Comment 4 antoniocs 2015-12-04 09:43:43 UTC
I have installed the java plugins so that I can view the profiler output (thanks for explaining that), but now I get an error about a failed dependency.

I have attached a screenshot. Please advise!
Comment 5 antoniocs 2015-12-07 17:24:02 UTC
Created attachment 157701 [details]
super slow
Comment 6 antoniocs 2015-12-07 17:27:04 UTC
I have added another screenshot just to show how slow the auto complete is.

I had just created that variable and on the next line when I was intending on using it, I started typing and then did ctrl+space, assuming netbeans would quickly autocomplete it, but it didn't, it gave me that little "Please wait..." text.

I really don't understand, I just created the variable and I am in the scope. I would assume that, however netbeans scans for variables, it would start in the scope its in.

I have also created a bug report on the failed dependency.
Comment 7 antoniocs 2015-12-09 10:34:18 UTC
Here is a link to a video that shows netbeans getting confused.

https://www.youtube.com/watch?v=mzLZX3E1BHs

As I state in the description, I have seen this confusion when trying to auto complete php array functions, I type 'array_' and then it takes 15s or more for netbeans to provide the auto complete list.
Comment 8 antoniocs 2015-12-16 11:38:50 UTC
Created attachment 157809 [details]
Profiler output
Comment 9 antoniocs 2015-12-16 11:40:36 UTC
I have attached the profiler output. I was trying to auto complete a method in a class and it took forever.

I hope that with this profiler output you can gain a better understanding of the problem and possibly fix this. I can't stress how disruptive this is for a programmer. You expect this to be a quick operation and it takes forever for netbeans to show the list even when auto completing methods from the class I am in.
Comment 10 Tomas Mysik 2016-01-04 12:43:22 UTC
Does it happen to you in all your PHP files? In all your PHP projects? Will it help if your try a clean/new userdir [1]? Or more precisely, if you clean your cache dir [2]?

Of course, it would help us if we could have a reproducible use case - is there any chance to get your project? Or is it possible to get a sample project with this problem?

Last but not least - always please attach your IDE log [3], it can contain some important information.

Thanks.
[1] http://wiki.netbeans.org/FaqAlternateUserdir
[2] http://wiki.netbeans.org/FaqWhatIsUserdir
[3] http://wiki.netbeans.org/FaqLogMessagesFile
Comment 11 antoniocs 2016-01-04 12:58:37 UTC
I don't think this is due to a cachedir issue just because I had these issues with a brand new laptop.

I cannot post any code as the code does not belong to me.
The projects I am using all use Symfony2, so maybe start with that.

I don't think you need a big project to test this. I think netbeans just "gets" confused sometimes, even with properties from the very class its in.
Comment 12 Tomas Mysik 2016-01-04 13:22:29 UTC
Just for clarification - I asked for reproducible use case since IMO we do not have any other issues similar to this one. And without reproducible use case it is generally difficult to fix anything :/

Anyway, we will investigate the profiler snapshot you have attached and hopefully will find some problem there.

Thanks.
Comment 13 antoniocs 2016-01-04 13:26:27 UTC
You don't?
Check out this quick google search https://www.google.com/search?q=netbeans+autocomple+slow&ie=utf-8&oe=utf-8
Comment 14 Tomas Mysik 2016-01-04 14:19:05 UTC
Only reports in this Bugzilla count; we cannot google and try to get feedback from random users from Internet, sorry.
Comment 15 antoniocs 2016-01-04 14:27:18 UTC
Sure, I understand that, but please don't make it sound like I am the only one complaining about this issue. I might be the only one trying to do something about this by reporting a bug but I am far from being alone.
Comment 16 Tomas Mysik 2016-01-04 14:48:35 UTC
(In reply to antoniocs from comment #15)
> please don't make it sound like I am the only
> one complaining about this issue.

I have to repeat myself - this is currently the only report we have in PHP area (if I am not wrong, of course) and therefore I asked you for reproducible use case (reason already explained).

> I might be the only one trying to do
> something about this by reporting a bug but I am far from being alone.

And this is really great and appreciated, of course!

Thanks.
Comment 17 Tomas Mysik 2016-01-05 14:21:07 UTC
(In reply to antoniocs from comment #7)
> Here is a link to a video that shows netbeans getting confused.
> 
> https://www.youtube.com/watch?v=mzLZX3E1BHs

Just noticed that you have incorrectly defined the vardoc comment:

/* @var StepInterface */

But it should be:

/* @var $step StepInterface */

(type "vdoc" above $step declaration, press TAB and NetBeans will create the vardoc comment for you).

We tried to reproduce your issue using the incorrectly defined vardoc comment but no issue found, code completion is fast (in our testing PHP project).
Comment 18 antoniocs 2016-01-05 14:26:15 UTC
Forgot about the name but the thing is Netbeans would autocomplete sometimes fast sometimes super slow.
Comment 19 Tomas Mysik 2016-01-05 14:31:32 UTC
(In reply to antoniocs from comment #8)
> Created attachment 157809 [details]
> Profiler output

So, in this snapshot, there is unfortunately nothing suspicious - the whole snapshot is taken for 18 seconds, PHP support takes 2 x 5 seconds. Not sure how exactly you have it created so those 2 PHP activities could mean 1 or 2 invocations of code completion.

So, we need a better snapshot. Here are the exact steps, based on the Youtube video you have created:

- have the exact code as in the video - the code where you are going to complete local variable name
- invoke code completion - the first one is fast, at least this is what can be seen in the video
- start profiling
- invoke code completion - now, it should take really long time, again, based on the video
- wait till the code completion appears, do NOT type any characters!
- stop profiling
- reopen this issue
- attach the profiler here.

In other words, we need snapshot of exactly ONE long invocation of code completion.

Thanks for your cooperation!
Comment 20 antoniocs 2016-01-05 14:54:48 UTC
Most of the php projects I work are closed source so I can't give you the source code. I will try to create a mock project and test it that way.
Comment 21 Tomas Mysik 2016-01-05 15:39:00 UTC
(In reply to antoniocs from comment #20)
> Most of the php projects I work are closed source so I can't give you the
> source code. I will try to create a mock project and test it that way.

I understand that. Please, first try the steps from my previous comment (comment #19), it could help us.

Thanks.