| ECS Home Automation and Security Archives |
| Subject: From: Date: | Re: [ecs] looking for some Java expertise (large menu frames taking
a Jim Willeke Wed, 21 Feb 2007 11:58:37 -0500 |
I added these lines:
System.out.println("Display frame");
System.out.println(System.currentTimeMillis());
jframe.setVisible(true); // display it (takes FOREVER)
System.out.println(System.currentTimeMillis());
System.out.println("Wait 5 seconds");
Create frame
Display frame
1172076724593
1172076726343
Does not seem so long.....
Java jre1.5.0_06
On Windows XP SP2
-jim
Mark Gilmore wrote:
> hi everyone,
> i have recently noticed that *all* JAVA menu frames that contain a lot
> of elements (over 200 or so)
> can take a REALLY long time to display.
> specifically, it is the Frame.setVisible(true) call that is the culprit.
> the delay is proportional *only* to the number of elements in the frame.
> it happens with both normal Frames and JFrames.
> it happens in both Applets and stand-alone pgms.
>
> this can be seen in 3 places:
> 1) click the value of an Integer Object
> FireFox:
> The *initial* display can take as long as *30
> seconds*
> During this time,
> \WINDOWS\system32\rundll32.exe is pegging the CPU AT 98+%
> What this DLL has to do with a JAVA
> menu is beyond me (GatesWare).
> Thereafter, it takes 2-3 seconds
> I.E.:
> There is no long delay on 1st display (as with
> FireFox)
> It takes 2-3 seconds every time (acceptable,
> but see #2).
>
> 2) if you have a lot of objects (i have 390), click the ADD
> button in an ECS Page:
> FireFox: It takes 10+ seconds to display the Object
> menu every time
> (rundll32.exe does not seem to come into play
> for this one)
> IE: same as FireFox
>
> 3) compile/run the JAVA pgm below.
> This is a minimal pgm that reproduces the problem.
> It takes 14 seconds to display a frame containing 500 labels.
>
> any theories or suggestions would be greatly appreciated !
> i would also like to know who is (or is not ?) having similar problems.
>
> thanks,
> Mark Gilmore
> http://OmnipotenceSoftware.com
> 423-745-0026
>
>
> ********************************************
> TEST PGM:
> import java.lang.*;
> import java.awt.*;
> import java.awt.Component;
> import java.awt.Label;
> import javax.swing.JFrame;
> public class X
> {
> public static void main(String[] arg)
> {
> X1 x1 = new X1();
> x1.main(arg);
> }
> }
> class X1
> {
> public void main(String[] arg)
> {
> JFrame jframe = new JFrame("MenuLookDemo");
> jframe.getContentPane().setLayout(new
> FlowLayout(FlowLayout.CENTER, 2, 2));
> int x;
> System.out.println("Create frame");
> Label lb[] = new Label[500]; // create frame with
> 500 labels
> for (x = 0; x < 500; x++)
> {
> lb[x] = new Label(Integer.toString(x));
> jframe.getContentPane().add(lb[x]);
> }
> jframe.setSize(800, 400);
> System.out.println("Display frame");
> jframe.setVisible(true); // display it (takes
> FOREVER)
> System.out.println("Wait 5 seconds");
> try {Thread.sleep(5000);}
> catch (InterruptedException e0) {};
> System.exit(0);
> }
> }
>
> Mark Gilmore
> http://OmnipotenceSoftware.com
>
>
--
-jim
Phone: 419.564.7692
Email: jim@willeke.com
IM: jim@willeke.com (on MSN)
IM: jwilleke@gmail.com (on GOOGLE)
IM: jwilleke (on Yahoo)
IM: jeemster (on AIM)
My LinkedIn: http://www.linkedin.com/in/jwilleke
hi everyone,
i have recently noticed that *all* JAVA menu frames that contain a lot of elements (over 200 or so)
can take a REALLY long time to display.
specifically, it is the Frame.setVisible(true) call that is the culprit.
the delay is proportional *only* to the number of elements in the frame.
it happens with both normal Frames and JFrames.
it happens in both Applets and stand-alone pgms.
this can be seen in 3 places:
1) click the value of an Integer Object
FireFox:
The *initial* display can take as long as *30 seconds*
During this time, \WINDOWS\system32\rundll32.exe is pegging the CPU AT 98+%
What this DLL has to do with a JAVA menu is beyond me (GatesWare).
Thereafter, it takes 2-3 seconds
I.E.:
There is no long delay on 1st display (as with FireFox)
It takes 2-3 seconds every time (acceptable, but see #2).
2) if you have a lot of objects (i have 390), click the ADD button in an ECS Page:
FireFox: It takes 10+ seconds to display the Object menu every time
(rundll32.exe does not seem to come into play for this one)
IE: same as FireFox
3) compile/run the JAVA pgm below.
This is a minimal pgm that reproduces the problem.
It takes 14 seconds to display a frame containing 500 labels.
any theories or suggestions would be greatly appreciated !
i would also like to know who is (or is not ?) having similar problems.
thanks,
Mark Gilmore
http://OmnipotenceSoftware.com
423-745-0026
********************************************
TEST PGM:
import java.lang.*;
import java.awt.*;
import java.awt.Component;
import java.awt.Label;
import javax.swing.JFrame;
public class X
{
public static void main(String[] arg)
{
X1 x1 = new X1();
x1.main(arg);
}
}
class X1
{
public void main(String[] arg)
{
JFrame jframe = new JFrame("MenuLookDemo");
jframe.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));
int x;
System.out.println("Create frame");
Label lb[] = new Label[500]; // create frame with 500 labels
for (x = 0; x < 500; x++)
{
lb[x] = new Label(Integer.toString(x));
jframe.getContentPane().add(lb[x]);
}
jframe.setSize(800, 400);
System.out.println("Display frame");
jframe.setVisible(true); // display it (takes FOREVER)
System.out.println("Wait 5 seconds");
try {Thread.sleep(5000);}
catch (InterruptedException e0) {};
System.exit(0);
}
}
Mark Gilmore
http://OmnipotenceSoftware.com
Phone: 419.564.7692 Email: jim@willeke.com IM: jim@willeke.com (on MSN) IM: jwilleke@gmail.com (on GOOGLE) IM: jwilleke (on Yahoo) IM: jeemster (on AIM) My LinkedIn: http://www.linkedin.com/in/jwilleke