The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Weblog:   MacOS X is my Java development environment
Subject:  Still too flaky.
Date:  2003-10-29 11:03:02
From:  scottellsworth
Response to: Still too flaky.


Howdy, Brendon.

Thanks much for responding.

I have not run into any VM hangs, but I have, perhaps, been lucky. Certainly, a machine-wide hang would be a killer for an app. Out of curiosity, does it peg the cpu when it does this? Also, do you have a thread dump?

As far as extremely slow JTables, I know a number of slow repaint bugs were caught and killed between 1.4.1 update 1 and Panther. One of mine came from aggressive setfont calls - a free op on windows, and a very expensive one on Jaguar. It is better now. I see what you mean, though, about poor performance for a 50x500 table. The following code is glacial.

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

public class Test {
TableModel dataModel1 = new AbstractTableModel() {
public int getColumnCount() { return 50; }
public int getRowCount() { return 500;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
};
TableModel dataModel2 = new AbstractTableModel() {
ArrayList data=new ArrayList();
{
for (int col=0; col ArrayList oneCol=new ArrayList();
data.add(oneCol);
for (int row=0; row oneCol.add(new Integer(row*col));
}
}
}
public int getColumnCount() { return 50; }
public int getRowCount() { return 500;}
public Object getValueAt(int row, int col) {
ArrayList oneCol = (ArrayList)data.get(col);
return oneCol.get(row);
}
};
public Test() {
JTable table1 = new JTable(dataModel1);
JScrollPane scrollpane1 = new JScrollPane(table1);
JFrame frame1 = new JFrame("model 1");
table1.setPreferredScrollableViewportSize(new Dimension(500, 70));
frame1.getContentPane().add(scrollpane1, BorderLayout.CENTER);
frame1.pack();
frame1.setVisible(true);

JTable table2 = new JTable(dataModel2);
JScrollPane scrollpane2 = new JScrollPane(table2);
JFrame frame2 = new JFrame("model 2");
table2.setPreferredScrollableViewportSize(new Dimension(500, 70));
frame2.getContentPane().add(scrollpane2, BorderLayout.CENTER);
frame2.pack();
frame2.setVisible(true);
}

public static void main(String[] args) {
new Test();
}
}

I suggest filing a bug on this and the freeze you mentioned, as there is a chance that this is a regression that can be fixed fairly easily. (I intend to file one on the table drawing bug, but the more votes they get, the more likely they are to fix it.)

I know it sometimes seems that Apple is not listening, but they do actually respond. Whether they have enough people working on Java is a very valid question, and one that I do not know the answer to.

 Feed java.net RSS Feeds