How to compile Haxe code using cpp target that is fully stripped, no debug addons etc?
What can be used except -D dce=full
and --no-traces
to compile fastest and/or smallest executable?
-D dce=full
and --no-traces
and avoiding -debug
should make the build ready to deploy, on all Haxe targets.
Also good to know; In Haxe 3.2 the static analyzer is introduced, which was hidden under a compiler flag (-D analyzer
). The static analyzer takes care of const propagation, copy propagation, local dead code elimination, fusion and purity inference.
In Haxe 3.4 the static analyzer has settled and runs by default, so the -D analyzer
flag has been removed. But to have extra optimizations the -D analyzer-optimize
can be used. This builds a control flow graph and then the optimizer (if enabled) does some optimizations on that, like folding expressions, removing dead code, etc. This optimization flag is not enabled by default because of too many vars being eliminated for hxcpp, in Haxe 4.0 it will be enabled by default.
So I don't know which Haxe version you use, but you might want to check out if this analyzer helps for your build. It probably also depends on which (if any) framework you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With