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 251664 - Code completion takes forever on a throw statement.
Summary: Code completion takes forever on a throw statement.
Status: REOPENED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: Dev
Hardware: PC Linux
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-05 18:02 UTC by waldermort
Modified: 2017-05-23 18:49 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Profiler snapshot (309.91 KB, application/octet-stream)
2015-04-08 17:08 UTC, waldermort
Details

Note You need to log in before you can comment on or make changes to this bug.
Description waldermort 2015-04-05 18:02:21 UTC
When writing a 'throw new \Exception' statement, the code completion can take up to 30 seconds to provide a match. Very often the IDE will produce a popup asking if I want to report the problem.

Elsewhere code completion is very fast, the slowness only occurs after the 'throw' keyword. To make this even weirder, it only happens on a newly typed 'throw'. If I open a file and replace only an exception class, it is fast. Delete the whole line and retype 'throw' it is slow again.
Comment 1 Tomas Mysik 2015-04-07 07:56:52 UTC
(In reply to waldermort from comment #0)
> Very often the IDE will produce a
> popup asking if I want to report the problem.

Weird, this should create an issue automatically with all required information. Never mind, please, we need a profiler snapshot [1]. Simply start profiling, reproduce your problem and then (after ~30 seconds) stop profiling. Then reopen this issue and attach the profiler snapshot here.

Thanks for your cooperation.
[1] http://wiki.netbeans.org/FaqProfileMeNow
Comment 2 waldermort 2015-04-08 17:08:38 UTC
Created attachment 153099 [details]
Profiler snapshot

The requested profiler snapshot
Comment 3 Tomas Mysik 2015-04-09 05:56:13 UTC
Time is spent in PHP editor, please evaluate. Thanks.
Comment 4 Tomas Mysik 2016-08-02 09:57:50 UTC
@tzezula: Tome, I can see this:

org.apache.lucene.index.TermBuffer.read ()	8 285 ms (14%)	9 620 ms (0,9%)

Please, is it OK? It could be caused by deep PHP type hierarchy perhaps?

Thanks.
Comment 5 Tomas Zezula 2016-08-02 12:34:05 UTC
Reading terms is OK.
Mostly caused by high amount of ineffective small queries.
Comment 6 Tomas Mysik 2016-08-03 08:33:17 UTC
(In reply to Tomas Zezula from comment #5)
> Mostly caused by high amount of ineffective small queries.

I see. This is caused by deep class hierarchy, NetBeans tries to find all Exception classes. Unfortunately, currently no way (I know of) how to improve/fix it, sorry.

Thanks for reporting.
Comment 7 twifty 2017-05-23 18:49:01 UTC
Two years later, and this issue still annoys the hell out of me. I guess it was pushed back and forgot about.

I've got to the point where I make my exception classes implement a static method:

class SomeException extends \RuntimeException
{
    public static function create($message)
    {
        return new self($message);
    }
}

Now when throwing an exception I can:

throw SomeException::create('foo');


The autocomplete works as expected.