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 111047 - Scrolling in big files is slow.
Summary: Scrolling in big files is slow.
Status: RESOLVED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: languages (show other bugs)
Version: 6.x
Hardware: HP Windows XP
: P2 blocker (vote)
Assignee: Jan Jancura
URL:
Keywords: PERFORMANCE
Depends on: 112464
Blocks:
  Show dependency tree
 
Reported: 2007-07-26 07:18 UTC by bslayer
Modified: 2007-08-20 15:35 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The sample JSP file (49.92 KB, text/html)
2007-07-26 07:21 UTC, bslayer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bslayer 2007-07-26 07:18:53 UTC
When I open a big complicated JSP file containing html elements and many javascript segments add up to about 1k lines,
the IDE shows 'parsing...' in the JSP navigator window on the left-bottom part of the whole IDE window, then it stopped,
doesn't do any thing more except can be minim/maxium, the java.exe process takes more than 40% CPU time( I use Core Duo
2). The only thing I can do is kill the Java.exe process. This problem never appears in NB5.5.
If the Jsp file is needed to inspect the problem, please cantact bslayer@sohu.com
Comment 1 bslayer 2007-07-26 07:21:14 UTC
Created attachment 45748 [details]
The sample JSP file
Comment 2 bslayer 2007-07-27 04:27:14 UTC
The version of my NB is NetBeans IDE 6.0 Dev (Build 200707251200). I fogot to descript it yestoday.
Comment 3 dynamite 2007-07-27 15:40:27 UTC
I'm seeing this as well on build of the 26th, but seems better on a build of 23rd.
Comment 4 Marek Fukala 2007-07-27 18:12:25 UTC
Reproducible, scrolling in the editor is still very slow. Needs to be fixed soon.
Comment 5 dynamite 2007-07-30 09:26:48 UTC
Things seem better in a build from the 20th...
Comment 6 dynamite 2007-07-30 11:23:07 UTC
Mind you, JavaScript parsing and editing still seems to be in slow motion.
Comment 7 Marek Fukala 2007-08-02 21:40:48 UTC
As for the slow editor scrolling, it seems most of the time during scrolling is spent in 

"AWT-EventQueue-1" prio=10 tid=0x09037800 nid=0x1e5c runnable [0x87197000..0x87198fc0]
   java.lang.Thread.State: RUNNABLE
        at org.netbeans.modules.languages.features.DatabaseContext.getDatabaseItem(DatabaseContext.java:147)
        at org.netbeans.modules.languages.features.ColorsManager.getColors(ColorsManager.java:77)
        at
org.netbeans.modules.languages.features.SemanticHighlightsLayer$Highlights.moveNext(SemanticHighlightsLayer.java:101)

It looks like using some binary search mechanism instead of linearly iterating all items when searching for contexts,
definitions and usages in DatabaseItem.getDatabaseItem (int offset) method would improve the performance quite a lot.

Since all:
private List<DatabaseContext>           contexts;
private List<DatabaseDefinition>        definitions;
private List<DatabaseUsage>             usages;

extends DatabaseItem which contains start and end offsets of the items, it is possible to create a sorted list or array
according to the start offset. Searching for items in such array would be much faster than, at least for bigger files.

I do not claim this is the only problem which causes the slowness, but looks like a good candidate to fix.

There are other issues like the parsing of the file takes quite a long time so when user edits the file the CPU is most
of the time in very high activity.
Comment 8 Jan Jancura 2007-08-03 11:26:08 UTC
Thanks for suggestions, Marek. We are working on it.
Comment 9 Jan Jancura 2007-08-09 15:06:48 UTC
Looks like the main issue is in editor.
Comment 10 Jan Jancura 2007-08-16 16:49:07 UTC
Improvements applied to DatabaseContext:
IDE:-------------------------------------------------
IDE: [8/16/07 5:45 PM] Committing "Generic Languages Framework" started
Checking in api/languages/ASTPath.java;
/cvs/languages/engine/src/org/netbeans/api/languages/ASTPath.java,v  <--  ASTPath.java
new revision: 1.7; previous revision: 1.6
done
Checking in api/languages/ASTToken.java;
/cvs/languages/engine/src/org/netbeans/api/languages/ASTToken.java,v  <--  ASTToken.java
new revision: 1.6; previous revision: 1.5
done
Checking in modules/languages/features/DatabaseContext.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/features/DatabaseContext.java,v  <--  DatabaseContext.java
new revision: 1.3; previous revision: 1.2
done
Checking in modules/languages/ParserManagerImpl.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/ParserManagerImpl.java,v  <--  ParserManagerImpl.java
new revision: 1.36; previous revision: 1.35
done
IDE: [8/16/07 5:45 PM] Committing "Generic Languages Framework" finished
Comment 11 Jan Jancura 2007-08-20 15:35:38 UTC
This issue has already been fixed.