title: JavaFX application boot time performance
body: <p>I am creating my first JavaFX application, here is a bogged down version:</p>
  
  <pre><code>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);
      }
  
  }
  </code></pre>
  
  <p>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 <a href="http://efxclipse.org/" rel="nofollow">e(fx)clipse</a> for building my app.</p>
  
  <p>My dev machine is:</p>
  
  <pre><code>Intel Core i5-3330 (3GHz)
  8 GB RAM
  Windows 7
  </code></pre>
  
  <p>In Eclipse, the application boots up in about <strong>1 second</strong>. This is fine. A built JAR launched with <code>java -jar</code> on the same machine takes about <strong>3-4 seconds</strong> to boot. This is too slow.</p>
  
  <p>Another machine is:</p>
  
  <pre><code>Intel Pentium Dual-Core E5400 (2.7GHz)
  4 GB RAM
  Windows Vista
  </code></pre>
  
  <p>Launching a JAR on this machine takes <strong>1 second</strong>... wait, what? Why?</p>
  
  <p>And finally:</p>
  
  <pre><code>2 x 2.26 GHz Quad-Core Intel Xeon
  32 GB 1066 MHz DDR3 ECC
  OS X 10.8.2
  </code></pre>
  
  <p>App boot up time: <strong>2 seconds</strong></p>
  
  <p>O_o</p>
  
  <p>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! </p>
  
  <p>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 (<a href="http://www.oracle.com/technetwork/java/javafx/samples/index.html" rel="nofollow">Ensemble</a> takes about 2 seconds on my dev machine).</p>
  
  <p>I will appreciate any additional tips relating to JavaFX optimization.</p>