4 ms·
Don't forget the 'inline' keyword for functions, it saved my bacon in some audio-processing code that was starting to choke, repeating stuff for every sample in
by CmdrKrool 14y ago
Don't forget the 'inline' keyword for functions, it saved my bacon in some audio-processing code that was starting to choke, repeating stuff for every sample in a tight loop - copy-pasting away the function calls wasn't really feasible - type 'inline' in a couple of places, now it's tidy and fast. I came more-or-less directly to Haxe as a better ActionScript, and had to check whether I could have done the same in AS3, and found that no, it doesn't have that keyword. I was so relieved at my language choice just then, else I would have been screwed. (Still half expecting for someone to tell me I've missed some aspect of ActionScript there.)
The Polygonal data structures library (http://polygonal.github.com/ds/doc/ http://polygonal.github.com/ds/doc/) is also thoughtfully designed with STL-like abstractions, and excellently documented right down to time-complexity of methods being stated. If you ask me it should be folded into the Haxe standard library. One admitted difficulty I've had using the standard data structures is not really being sure what the most efficient one to use is, when even if you're sticking to one language - say JavaScript - your 'array' could really be a linked-list underneath and vice-versa, and if you're writing to make use of Haxe's cross-platformability (which I haven't yet) then God knows where you actually stand.
- NetMonkey 14y agoIt's now (finally) possible to inline with newest actionscript compiler and it's included in the recently released FlashBuilder 4.7: http://www.bytearray.org/?p=4789 http://www.bytearray.org/?p=4789 Just compile with the -inline argument. The compiler sometimes chokes in some rare cases where it can't inline, and it makes debugging much harder as the line offsets don't match the source code anymore. But the performance gains can be huge as function calls are rather expensive in Flash, and you can just debug without the -inline argument.