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 232264

Summary: Replace EditorCookie.getOpenedPanes() with something faster
Product: utilities Reporter: misterm <misterm>
Component: SearchAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal Keywords: NETFIX, PERFORMANCE
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 201909
Attachments: nps snapshot
screenshot
profiler snapshot

Description misterm 2013-07-04 12:05:30 UTC
This bug was originally marked as duplicate of bug 227989, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 20130703-4ccc4c622a55)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.3-b01, Java(TM) SE Runtime Environment, 1.7.0_07-b11
OS: Windows 7

User Comments:
misterm: .



Maximum slowness yet reported was 3237 ms, average is 3237
Comment 1 misterm 2013-07-04 12:05:32 UTC
Created attachment 136713 [details]
nps snapshot
Comment 2 Stanislav Aubrecht 2013-07-08 08:26:55 UTC
OpenFilesSearchScopeProvider.OpenFilesScope.isFromEditorWindow is asking for CloneableEditorSupport.getOpenedPanes which may be costly.
Please check if there's an alternate API for that, thanks.
Comment 3 Jaroslav Havlin 2013-08-29 14:09:20 UTC
I've tried replacing
"editor.getOpenedPanes() != null"
with
"editor.getDocument() != null",
but it's not guaranteed that it returns null for already closed documents.
More investigation is needed.
Comment 4 markiewb 2013-08-30 15:47:28 UTC
Created attachment 139506 [details]
screenshot

I also had such an issue that NB froze today.

Product Version: NetBeans IDE Dev (Build 201308290001)
Updates: Updates available
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)

Right before I installed http://plugins.netbeans.org/plugin/45925/sort-line-tools.
I sampled NB while it was frozen. See attachment (screenshot and snapshot).

The root cause seems to be https://github.com/markiewb/nb-sort-line-tools/blob/master/src/org/netbeans/modules/linetools/actions/AbstractLineAction.java?source=cc#L80
Comment 5 markiewb 2013-08-30 15:49:17 UTC
Created attachment 139507 [details]
profiler snapshot
Comment 6 markiewb 2013-08-30 15:51:35 UTC
(In reply to markiewb from comment #4)
> The root cause seems to be
> https://github.com/markiewb/nb-sort-line-tools/blob/master/src/org/netbeans/
> modules/linetools/actions/AbstractLineAction.java?source=cc#L80

If this is really my fault (BTW I only repacked the plugin, sandchiptale was the original author) please tell me which API I can use to fix it.
Comment 7 markiewb 2013-08-30 16:08:17 UTC
(In reply to markiewb from comment #6)
> (In reply to markiewb from comment #4)
> > The root cause seems to be
> > https://github.com/markiewb/nb-sort-line-tools/blob/master/src/org/netbeans/
> > modules/linetools/actions/AbstractLineAction.java?source=cc#L80
> 
> If this is really my fault (BTW I only repacked the plugin, sandchiptale was
> the original author) please tell me which API I can use to fix it.

{code}
JEditorPane pane = NbDocument.findRecentEditorPane(ec);
{code}
would be the solution I guess - taken from http://hg.netbeans.org/main-golden/rev/21e2a273a524
Comment 8 markiewb 2013-08-31 16:20:55 UTC
(In reply to markiewb from comment #7)
> (In reply to markiewb from comment #6)
> > (In reply to markiewb from comment #4)
> > > The root cause seems to be
> > > https://github.com/markiewb/nb-sort-line-tools/blob/master/src/org/netbeans/
> > > modules/linetools/actions/AbstractLineAction.java?source=cc#L80
> > 
> > If this is really my fault (BTW I only repacked the plugin, sandchiptale was
> > the original author) please tell me which API I can use to fix it.
> 
> {code}
> JEditorPane pane = NbDocument.findRecentEditorPane(ec);
> {code}
> would be the solution I guess - taken from
> http://hg.netbeans.org/main-golden/rev/21e2a273a524

FYI: If it was an issue caused by the plugin, so it is now solved by version 1.12.
* https://github.com/markiewb/nb-sort-line-tools/commit/c92ddf60b18ad21b9654830719945344e8365e56
* http://plugins.netbeans.org/plugin/45925 (currently pending for verification)
Comment 9 Jaroslav Havlin 2013-09-03 14:21:52 UTC
> JEditorPane pane = NbDocument.findRecentEditorPane(ec);
Fixed in http://hg.netbeans.org/core-main/rev/cc60d35659aa.
Thank you very much.