Flex Compiler Shellで高速コンパイル
Flexのコンパイルを高速化できる「Flex Compiler Shell」を使ってみました。(via 川o・-・)<2nd life - ActionScript3 (mxmlc) でのコンパイルを100倍速にする方法)
インストール
- Flex Compiler Shellから「flex_compiler_shell_012307.zip」をダウンロード。
- 「flex_compiler_shell_012307.zip」を展開。
- 展開してできるbin以下のファイル(fsch,fcsh.exe)を
/bin以下にコピー。 - 展開してできるlib以下のファイル(fsch.jar)を
/lib以下にコピー。
コンパイルしてみる。
1.「fcsh」を実行し、fcshを起動します。
$ fcsh Adobe Flex Compiler SHell (fcsh) Version 2.0.1 build 155542 Copyright (c) 2004-2006 Adobe Systems, Inc. All rights reserved. (fcsh)
2.fcsh内で「mxmlc
(fcsh) mxmlc hello.mxml fcsh: Assigned 1 as the compile target id Loading configuration file .../flex/frameworks/flex-config.xml Loading configuration file .../helloworld/hello-config.xml .../helloworld/bin/hello.swf (131556 bytes)
3.このとき、コンパイルIDが返されます。上の「fcsh: Assigned 1 as the compile target id」の部分の「1」がそれです。
4.次回以降のコンパイルは「compile <コンパイルID>」で高速にコンパイル可能です。
(fcsh) compile 1 Loading configuration file .../flex/frameworks/flex-config.xml Loading configuration file .../helloworld/hello-config.xml Nothing has changed since the last compile. Skip... .../helloworld/bin/hello.swf (131556 bytes)
5.「quit」でfcshを終了します。
どれだけ早いか
mxmlcの-benchmarkを使って、Hello Worldをコンパイルする時間をそれぞれ計ってみました。結果は以下のとおり。かなり高速です!
コンパイル方法 | 所要時間 |
---|---|
mxmlc | 約51.7秒 |
fschを利用(初回) | 約19.0秒 |
fschを利用(ファイルを修正して2回目) | 約2.4秒 |
コンパイルしたファイル:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete = "main()" > <!-- ラベルを貼り付ける --> <mx:Panel title="" width="200" height="100"> <mx:Label id="stdout" /> </mx:Panel> <mx:Script> <![CDATA[ // メイン public function main():void { stdout.text = "Hello World!!"; } ]]> </mx:Script> </mx:Application>
参考:川o・-・)<2nd life - ActionScript3 (mxmlc) でのコンパイルを100倍速にする方法