NSTableView, Java, and Performance
NSTableView, Java, and Performance
- Subject: NSTableView, Java, and Performance
- From: "Nathan V. Roberts" <email@hidden>
- Date: Wed, 6 Jun 2001 16:17:39 -0500
Hi,
I'm relatively new to Cocoa, and I'm putting together a small Java
Cocoa app that uses an NSTableView for its display. It's very slow;
resizing is jerky, and there are noticeable redraw flashes during the
resize. The response to double-clicking to edit, or double-clicking
a column to sort, is very slow (the sort itself, however, happens
quickly--we just get the spinning rainbow for a second after the
double-click, and then everything gets sorted).
I have very little data (20 rows, 6 columns), so I'd expect much
better performance than this. (And running Objective C examples like
Erik Thorteran's just now, gets excellent performance--are there
Java-specific issues I should be aware of?)
I'm wondering what NSTableView does in a typical redraw. What I'd expect:
1. asks how many rows there are.
2. figures out which ones it can display.
3. asks for each of those.
4. converts them to Strings, or whatever is appropriate.
(I'd be interested in the details of how this happens)
5. draws the cells.
Now, I did a little time-testing of my code, and I found that to do
1, 3, and 4 for all my table values 3000 times takes around 6
seconds. So that's about 2 milliseconds per full table display (the
delays I'm seeing are usually 1/2 second or so), which makes me think
that my problem is not the raw efficiency of my code (although I can
certainly improve it), but the way that I'm talking to the
NSTableView.
I'd greatly appreciate any tips or suggestions for further investigation.
Thanks,
Nathan Roberts