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 101417 - Class diagrams very slow when reverse-engineering large project
Summary: Class diagrams very slow when reverse-engineering large project
Status: NEW
Alias: None
Product: uml
Classification: Unclassified
Component: Diagram Class (show other bugs)
Version: 5.x
Hardware: PC All
: P3 blocker with 1 vote (vote)
Assignee: Viktor Lapitski
Depends on: 148416
Blocks: 103340
  Show dependency tree
Reported: 2007-04-17 17:24 UTC by eduardmanas
Modified: 2009-05-25 21:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description eduardmanas 2007-04-17 17:24:00 UTC

The performance of class diagrams is very bad after reverse-engineering a large 
project (1500+ classes).  There is a delay of few seconds (some times 10+ 
seconds) for each interaction with the diagram (i.e. moving classes around, 
right-clicking for popup menu...).  This may be a wider problem and not only 
affeting class diagrams.

This is not a memory issue (memory configuration '-Xms128m -Xmx512m'), it seems 
to be a processor issue (after each interaction, memory estable, processor 50-
70%).  It is not noticeable for small projects with handful of classes.

My PC spec is Pentium 4 2.8Ghz with 2GB memory

Comment 1 Peter Lam 2007-04-20 06:30:45 UTC
I tried reverse engineering (RE) the uml core sources (~2700+ classes) on my
Windows XP laptop (1.8GHz, 1GB RAM) and it completed in less than 5 minutes.
Below is the output. However, there's a problem with memory usage. After the RE
action, the memory usage is 599208K from the Task Manager and it never came down
-- this is a separate issue I filed as issue 101895. Even with that, I created a
class diagram from a combination of classes and interfaces and one package (22
elements) from the RE model. UI responsiveness is still good. Then, in the class
diagram, responsiveness for all actions are still with no delay - only the 1st
popup menu that took about 2 seconds. My ide memory setting is  -Xmx512m. Since
you mentioned you're on 64-bit, I'm not sure if that should make a difference.

Because the memory usage on the process does not come down after the RE action,
I'd suggest to restart IDE to release some memory usage. I'm sure this will
speed up something.

Begin processing Reverse Engineering
Parsing 2,699 elements
Analyzing attributes & operations for 2,910 symbols
Resolving 1,895 attribute types
Integrating 2,910 elements
Building the query cache.
Task Successful (total time: 4 minutes 39 seconds)
Comment 2 eduardmanas 2007-04-25 17:11:39 UTC
I would like to clarify this issue is about delays while interacting in class 
diagrams.  (it is not due to memory problems, and re-starting Netbeans doesn't 
make a difference; also, it is not about time taken to reverse engineer)

I think the problem is caused by very popular classes (i.e. lots of classes use 
it).  One of the culprits in my project has approx 500 usages, including 
instance creation and method calls. It doesn't seem to be related to the 
project size.

If I create a blank class diagram, I can start adding 'normal' classes without 
a problem.  However, once I add the above class, if I right-click on any class 
in the diagram, the popup takes approx 5-10 seconds.  Interacting with the 
diagram is also slowed down, but delay not as long as popup.

Comment 3 George Vasick 2007-05-17 18:48:16 UTC
Planned for drawing area upgrade after NB 6.0.
Comment 4 Marian Mirilovic 2007-05-17 21:18:41 UTC
please don't use LATER - see issue 93179 for the reason
Comment 5 _ rkubacki 2007-05-25 20:13:35 UTC
The original thread is
Comment 6 roridge 2007-11-30 13:46:03 UTC
I have found this issue using 6.0 RC2

But I have only reverse engineered 5 classes, and my class diagram is very slow. Mostly when clicking on classes to move
them around.

I upped the memory for Netbeans, but that made no difference. 
Comment 7 Sergey Petrov 2008-09-18 16:37:18 UTC
Is there a way to attach problematic project to this issue?
Comment 8 Trey Spiva 2008-09-25 18:52:14 UTC
I reversed engineered the UML core module and created a diagram that contains all of the model elements in the metamodel package.  The result was an 
exception that was thrown.  I have made this issue depend on the issue that encompasses the exception.
Comment 9 Viktor Lapitski 2008-10-04 03:04:00 UTC
The class below demonstrates what is happening with large diagrams 
(on the order of several hundreds of nodes and a couple thousands of edges)
in version 6.5. The bug 6755974 was filed for jdk java2d. 
Theoretically a possible workaround (though implementation 
effort for it isn't yet estimated and looks to be non-trivial), 
is to do "logical scaling" in the widget 
model instead of using scaling feature of Graphics2D.

----------- ---------

import java.awt.*;
import javax.swing.*;

public class test_DashFrame
  extends javax.swing.JFrame

    static class DashPanel extends JPanel {
        public void paint(Graphics g)
            double scale = 0.01;
            Graphics2D g2 = (Graphics2D) g;  
            g2.scale(scale, scale);
            System.out.println("isDoubleBuffered() = "+isDoubleBuffered());  
            long cnt = System.currentTimeMillis();
            for (int i = 0; i < 50000; i+= 100)
                Stroke old = g2.getStroke();
                g2.drawLine(i, 0, 50000 - i, 50000);
            System.out.println("PAINT vertical took "+(System.currentTimeMillis() - cnt));  
            cnt = System.currentTimeMillis();
            for (int i = 0; i < 50000; i+= 100)
                Stroke old = g2.getStroke();
                g2.drawLine(0, i, 50000, 50000 - i);
            System.out.println("PAINT horizontal took "+(System.currentTimeMillis() - cnt));

  private static Stroke stroke = new BasicStroke(
    new float[] { 1, 1 }, 

  public static void main(String[] args)
    Frame f = new test_DashFrame();
    JPanel p = new DashPanel();
    p.setMinimumSize(new Dimension(500, 500));
    f.setBounds(100, 100, 600, 600);