Re: efficiency of JList setElementAt()
- From: "Raymond Cruz" <nospam@xxxxxxxxxxx>
- Date: Mon, 19 Dec 2005 23:27:02 GMT
"Thomas Hawtin" <usenet@xxxxxxxxxxxxxxxxx> wrote in message
news:43a73e46$0$1486$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Raymond Cruz wrote:
> > 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? Also, the modification
time
> > increases approximately linearly with list size. If I make the list 1/2
the
> > size about 19% of the CPU is consumed.
> >
> > It seems that if my list size grows, frequency of updates increases, or
if I
> > operate more than a single list at a time (all of which are planned), I
will
> > drag even a quite fast machine to its knees. Are there more efficient
> > alternatives available? The target machine is Windows, JRE 1.4.2_08 and
the
> > development environment is Eclipse 3.1.
>
> PL&F revalidates and repaints the entire list if any of it changes.
> Fortunately, there should only be so much on the screen that can be
> revalidate and repainted. However, the quoted times do seem excessive.
>
> Tom Hawtin
The problem isn't very sensitive to how much is on the screen. For the
examples given, approximately 75% of the list was outside of the scroller's
viewport. In fact, if the frame that displays the JList is minimized to a
null display, the timing improves by only about 15%.
RC
.
- Follow-Ups:
- Re: efficiency of JList setElementAt()
- From: Thomas Hawtin
- Re: efficiency of JList setElementAt()
- References:
- efficiency of JList setElementAt()
- From: Raymond Cruz
- Re: efficiency of JList setElementAt()
- From: Thomas Hawtin
- efficiency of JList setElementAt()
- Prev by Date: Re: Any easy way to run a Swing application as standalone?
- Next by Date: Re: efficiency of JList setElementAt()
- Previous by thread: Re: efficiency of JList setElementAt()
- Next by thread: Re: efficiency of JList setElementAt()
- Index(es):
Relevant Pages
|
|