dcsimg
Braindead AWT performance question re: eventLoop, thread priority, application performance
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Luke_Gerke
Posted On:   Thursday, January 10, 2002 10:58 AM

Hi. I apologize in advance for this stupid question. I just can't find an answer for it elsewhere..... Maybe I've misread the problem entirely. I'm new to java and threads and AWT. I just wrote my first application, and off the bat it runs slow. I ran hprof, and the first thing I noticed was that sun.awt.windows.WToolkit.eventLoop accounts for conspicuously near 50% of the samples. I was wondering: is this due to two threads fighting for time? And assuming it is the event monitoring thread fighting with my "main" thread, is there anything I can do about it? I assume most single threaded applications (with another thread for the AWT gui) don't have to spend 50% of time in the gui, do they? Thanks for your h   More>>

Hi. I apologize in advance for this stupid question. I just can't find an answer for it elsewhere..... Maybe I've misread the problem entirely.


I'm new to java and threads and AWT. I just wrote my first application, and off the bat it runs slow. I ran hprof, and the first thing I noticed was that sun.awt.windows.WToolkit.eventLoop accounts for conspicuously near 50% of the samples. I was wondering: is this due to two threads fighting for time? And assuming it is the event monitoring thread fighting with my "main" thread, is there anything I can do about it? I assume most single threaded applications (with another thread for the AWT gui) don't have to spend 50% of time in the gui, do they?


Thanks for your help, and sorry if I'm way off.


Luke Gerke

   <<Less

Re: Braindead AWT performance question re: eventLoop, thread priority, application performance

Posted By:   Scott_Stanchfield  
Posted On:   Sunday, January 27, 2002 07:02 AM

You are a bit off... ;)

Whenever you register an event listener for GUI events (like an ActionListener for a Button in the GUI), that event handler code will be run by the event loop thread.

Generally, in a GUI application, the main thread does nothing more than create the GUI and say "go" (by setting the GUI visible). After that, the main thread is done running.

Under normal circumstances, all the real work is performed by the event thread (unless you start other threads yourself). This isn't a problem, and doesn't cost anything extra in performance (some thread has to do the work...)

About | Sitemap | Contact