4

Clojure と Seesaw を使用して GUI アプリを作成し始めました。JFrame といくつかのコンポーネントを作成するだけで、それ以上のことはしません。これがコードです。main 関数は何もせず、start-gui戻ったらすぐに呼び出して終了します。

(ns pause.gui
  (:use seesaw.core))

(native!)
; (javax.swing.UIManager/setLookAndFeel
;   "org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel")

(def main-window
  (frame :title    "Pause"
         :on-close :exit))

(def sidebar (listbox :model []))
(def main-area (text :multi-line? true
                     :font "MONOSPACED-PLAIN-14"
                     :text "test"))

(def main-split
  (left-right-split (scrollable sidebar)
                    (scrollable main-area)
                    :divider-location 1/5))

(defn setup-main-window
  "Fills the main window with its content"
  [main-window]
  (config! main-window
           :content main-split)
  main-window)

(defn start-gui
  "Create the main window"
  []
  (-> main-window
      setup-main-window
      pack!
      show!))

を使用してこれをコンパイルしlein uberjar、 で時間を計りましたtime java -jar。14.5秒と報告されました。私が間違っていることはありますか?3 秒の起動で問題ありませんが、これはまったく受け入れられません。

4

1 に答える 1

2

悲しいことに、Clojure にはまだかなりの起動時間があります。これは主に、Clojure が必要なすべての名前空間をロードするときに発生するコンパイル/コードのロードの量によるものです。

私が作成した Swing ベースの GUI アプリのmain場合、最初の GUI またはスプラッシュ スクリーンをユーザーにすばやく表示できるように、Java でエントリ ポイントを作成することがよくあります。その間、残りのアプリ / Clojure コードは背景。

于 2013-07-15T08:57:57.700 に答える