-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHP] UI freeze for over 2 minutes when attempting to use "Fix Imports" #6039
Comments
@czukowski Could you provide an example code to reproduce it? |
@junichi11 it happens with any PHP file from my project, no matter how big or small. Unfortunately I cannot share the project because of an NDA. I am currently trying to see if I can reproduce the same issue with any kind of large open source project. As a side note, in the mean time I tried to examine IDE with Process Monitor and I noticed a few unexpected things that might affect performance, however it is probably unrelated to this specific issue, unless there were some changes affecting these parts since NB 17:
|
I've reverted changes related to "Fix Imports" once, then I've fixed some issues without complicated changes again. Please give it a try when NB19-rc is released if possible. |
Thanks @junichi11 I've tried to reproduce the issue with the largest open source PHP based project I know (Magento) but I wasn't able to reach similar results. I was able to partially mitigate the issue in NB18 by adding most of the I'll post an update when NB19 is out, however I fear that the main cause of the issue is the operating system and its notoriously slow (or so they say) file system, multiplied by the project size and amount of data to parse and changes to "Fix Imports" only helped to manifest that more. Perhaps there is a space for some optimizations in that field, but it seems like a lot of work and definitely outside of the scope of this issue. |
I've tried "Fix Imports" with NB19-r1 after removing Just as with NB18, the "Lengthy operation in progress" message did not appear and restarting the IDE didn't help it either. I tried the same files with NB18 again and I discovered the same kind of consistency, that some files appear to be "better" than others, but overall NB19-r1 is seemingly a little better than NB18. In comparison, with NB17 "Fix Imports" works instantly on all of the same set of files. I've only tried files with up to 500 lines and up to 50 use statements (50 was maximum, on average maybe just about 10). In all cases I waited for the initial "Background Scanning" to finish to make sure it didn't interfere. I'll post an update if I figure out anything else. Thanks again for looking into it! |
@junichi11 I think I'm onto something. The issue seems to be related to doc-comments parser. It suffices to add a I used Magento for testing. The steps to reproduce are to clone its repo, initialize Composer dependencies and then beef it up some more by adding additional dependencies known to be rather large (I could tell a difference even without additional dependencies but it wasn't so severe): git clone https://github.com/magento/magento2.git .
composer install
composer require aws/aws-php-sns-message-validator:* facebook/graph-sdk:* facebook/php-business-sdk:* google/apiclient:* nikic/php-parser:* phing/phing:* php-coord/php-coord:* phpoffice/phpspreadsheet:* I searched for a function that returned array and the first file I found was
But not this:
|
@czukowski Thanks for investigating it. I'll try it later. |
- apache#6039 - Remove `<>` and `{}` from type name - Ignore an empty type name to avoid getting all types - Add unit tests
Your information was helpful. Thanks. |
Avoid getting all types with an empty type name #6039
Please give it a try when NB19-rc2 is released. |
Confirmed as fixed in rc3. |
Apache NetBeans version
Apache NetBeans 18
What happened
Right after invoking "Fix Imports" (Ctrl+Shift+I), the whole UI freezes for a prolonged period of time. During all that time a whole CPU core is at 100% use by the IDE. Eventually the dialog appears with the suggestions, the UI unfreezes and can be used again. Repeated use freeze the UI for about the same time.
I work on a fairly large project, it does take a toll on the overall IDE performance, but the same action in NetBeans 17 usually took at most a couple of seconds.
How to reproduce
Just invoke "Fix Imports" (Ctrl+Shift+I)
Did this work correctly in an earlier version?
Apache NetBeans 17
Operating System
Windows 10
JDK
18.0.2.1; OpenJDK 64-Bit Server VM 18.0.2.1+1-1
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
It's a fresh NetBeans install, user and cache directories just finished initializing.
Release notes for NetBeans 18 mentions several changes to Fix Imports function, perhaps one of them is causing a performance issue.
According to Process Explorer, memory usage remained stable, also no significant I/O access occurred for the duration.
I've taken an IDE profiling snapshot in case it helps, where may I upload it?
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: