On Wed, Jul 30, 2008 at 5:44 PM, laurent <[EMAIL PROTECTED]> wrote:
>
> Can you decompile the push method to see how it use the stack ? :)

I take the :) you already know the answer, but just in case, it's
intrinsic and you can probably look the C++ code up in the Tamarin
sources.

I have to agree with Juan that you shouldn't take those results
seriously. The numbers are closer to each other than the margin of
error.
When I set up such a test (sorry, no code on this machine), I wait a
few frames so the player is fully initialized, and then run several
test of each variant. I take the best result and discard the rest --
the average or median are worthless, they just tell you how much other
processes on the system interfere with the test, and the worst tells
you if the garbage collector did its round.

In any case, don't go down the "X does Y the fastest, so I'll only use
X from now on" route. If you're writing some selected inner loops or a
math library, OK, but most of your code won't get executed thousands
of times each frame, so it's much more important that it's readable
and easy to understand for others (including future-you). This is
especially true if your "fastest" solution is verbose and repetitive
--  it's inconvenient if you have to modify it in the future, add
traces for debugging or step through with the debugger.

Also, whether writing something in a single line or two is faster
depends on the compiler, and might change when better optimization is
introduced in a future version. Common ways of doing something are
probably more likely to get optimized.

Stating the obvious, try to find a better algorithm first.

And finally, have a look at haXe. That touches the compiler
optimization part again -- the haXe compiler knows much about your
code than the AS3 compilers, so it can do better optimization. Part of
it is explained here:
<http://blog.haxe.org/entry/31>
Note inlining and haxe.rtti.Generic. For an AS3 vs haXe example, read:
<http://blog.haxe.org/entry/35>

Mark
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to