mbien opened a new pull request, #4501:
URL: https://github.com/apache/netbeans/pull/4501

   based on delivery for the slim chance that this gets a review
   
    - streams are not very good at canceling
    - by using a plain loop we can simply break out of it
    - further: `findUnused` is actually very fast, `convertUnused` is the slow 
part and wasn't cancelable before, the original code might have worked if 
`findUnused` returned a stream instead of a list and everything would be one 
pipeline (this would make the fix more complicated)
   
   issue:
   
    - a synthetic file with 10k fields pins a thread for about 20s
      at 100%
    - most editor features don't work during that time, e.g completion
    - hint is enabled by default
   
   
   discussion:
   
   noticed this while benchmarking other issues (#4500)
   
   #3886 mentioned the poor performance of 
`org.netbeans.modules.java.hints.bugs.Unused` and also that it isn't cancelable.
   #4204 attempted to fix some of it, however I am not so sure that this worked.
   
   test:
   
[FieldsOfJoy10k_Unused_hint.java.txt](https://github.com/apache/netbeans/files/9330547/FieldsOfJoy10k_Unused_hint.java.txt)
   
   scroll down to:
   ```java
       // hints -> probable bugs -> unused element
       // org.netbeans.modules.java.hints.bugs.Unused#unused
       private void something() {
           this.     // code change triggers hint and pins cpu to 100%,
                     // this blocks completion etc. does cancel work?
       }
   ```
   
   `Unused#convertUnused `/ `JavaFixUtilities#safelyRemoveFromParent` use most 
of the time and they were not cancelable.
   
   
![unused_element_hint_baseline](https://user-images.githubusercontent.com/114367/184464074-4f512a59-fcef-46b2-802d-246871a97e1a.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to