Search code examples
compilationhaxehaxeflixelhaxelib

Haxe how to speed up compilation (choosing fastest target)


I'm currently using Haxe, specifically haxeflixel for development. One thing that really bugs me is the build/compile time. I'm not even compiling to c++ target but decided to compile to neko vm as I thought it maybe faster. However; the compile time to neko debug (or release) is about 4 or 5 seconds. Having to wait this long every time I want to see a result makes it dreadfull :).

I even tried to debug with -v command and the parts that take the most time are:

Running command: BUILD
 - Copying library file:     

C:\HaxeToolkit\haxe\lib\lime/2,9,1/legacy/ndll/Windows/lime-legacy.ndll ->   export/windows/neko/
bin/lime-legacy.ndll

- Running command: haxe export/windows/neko/haxe/release.hxml

From the above excerpt it seems like everything is behaving normally, which worries me because I do not want normal to be this slow.

Now 4 or 5 seconds might not seem a lot to some people but with the Golang, javascript , java and other super faster compiled languages out there - i'm spoiled. Is there another target I can compile to that I dont know about which would be faster than neko vm compilation? Is there anything I can do to increase compile speed or further debug the cause of the compile slowness?


Solution

  • You can consider using the compilation server:

    1. From a terminal, run haxe --wait 6000
    2. In your hxml, add --connect 6000

    This will make your build use the compilation server, which caches unchanged modules and compiles only changed modules. This will speed up your build.