Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX application boot time performance

I am creating my first JavaFX application, here is a bogged down version:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class Main extends Application
{

    final private StackPane mainpane    = new StackPane();

    @Override
    public void start(Stage primaryStage)
    {
        // main panel
        this.mainpane.setMinWidth(1024);
        this.mainpane.setMinHeight(768);

        // show
        primaryStage.setScene(new Scene(this.mainpane));
        primaryStage.setResizable(false);
        primaryStage.show();
    }

    public static void main(String[] args)
    {
        launch(args);
    }

}

I have tried launching the above program on three computers and the bootup time results are... surprising. All machines are running latest Java version. I use e(fx)clipse for building my app.

My dev machine is:

Intel Core i5-3330 (3GHz)
8 GB RAM
Windows 7

In Eclipse, the application boots up in about 1 second. This is fine. A built JAR launched with java -jar on the same machine takes about 3-4 seconds to boot. This is too slow.

Another machine is:

Intel Pentium Dual-Core E5400 (2.7GHz)
4 GB RAM
Windows Vista

Launching a JAR on this machine takes 1 second... wait, what? Why?

And finally:

2 x 2.26 GHz Quad-Core Intel Xeon
32 GB 1066 MHz DDR3 ECC
OS X 10.8.2

App boot up time: 2 seconds

O_o

Now, I don't know much about optimizing Java applications, I don't know how make a profiling benchmark, but this seems pretty basic, this shouldn't be happening!

What can I do ensure fast, uniform boot times on all these platforms? I have launched other JavaFX apps on my machine and they load up quite quickly (Ensemble takes about 2 seconds on my dev machine).

I will appreciate any additional tips relating to JavaFX optimization.

like image 547
Dreen Avatar asked Sep 04 '26 11:09

Dreen


1 Answers

When bundling applications all we do is to call out to the JavaFX ant task so I'm not sure what to suggest :-( The only difference is that when packaging an application is that the bootstrap process of finding the javafxrt.jar has to be done which I don't think takes that long.

I guess you are running the same Java on the win32 systems. By the way, your message to our forum showed up to be moderated but I think I did something wrong when doing the moderation because it does not show up on the group - sorry for that :-(

Google groups sometimes acts very strange.

like image 172
tomsontom Avatar answered Sep 06 '26 00:09

tomsontom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!