Re: efficiency of JList setElementAt()
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Tue, 20 Dec 2005 05:03:01 GMT
On Mon, 19 Dec 2005 22:49:42 GMT, "Raymond Cruz" <nospam@xxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
>I have an application that displays about 130 text lines in a scrollable
>JList via the DefaultListModel. Approximately 1 entry is modified each
>second which is done by determining the position of the item and invoking
>setElementAt of the DefaultListModel object. My Athlon XP-1800+ machine
>consumes 31% of the system CPU when these operations occur but if I execute
>all the program logic with the single exception of the setElementAt call, it
>consumes only 3% of the CPU. Is it reasonable that modifying one element of
>a list once a second would consume so much CPU?
look at the code for DefaultListModel.setElementAt
public void setElementAt(Object obj, int index) {
delegate.setElementAt(obj, index);
fireContentsChanged(this, index, index);
delegate is an ordinary Vector. The problem coming from the busywork
inspired by fireContentsChanged.
Just what are you doing to render that row?
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- efficiency of JList setElementAt()
- From: Raymond Cruz
- efficiency of JList setElementAt()
- Prev by Date: Event Handling and Maintainability
- Next by Date: Re: efficiency of JList setElementAt()
- Previous by thread: Re: efficiency of JList setElementAt()
- Next by thread: Event Handling and Maintainability
- Index(es):
Relevant Pages
|