and switch on Number ? :P
I read somewhere that Number was quicker than int though I still can't believe it

cedric


I'd always thought that the most efficient was the switch

I know that the haXe compiler uses a jump table, I'm not sure about
the AS3 compiler. But as already mentioned there is an extra opcode
for switch, and even if the compiler doesn't a jump table, it might
use one in the future.

So, switch at least isn't slower, even if it isn't faster yet it has
the potential to become faster in the future, and it's more readable
in any case -- making switch the preferable choice.

The question should be "is switch on int faster than switch on String?"

Mark



On Wed, Jun 25, 2008 at 4:12 PM, Allandt Bik-Elliott (Receptacle)
<[EMAIL PROTECTED]> wrote:
Hi guys

quick question that came up in a conversation I had the other day - are
switch statements more or less efficient than a series of if...else
statements in either AS2 or AS3?

I'd always thought that the most efficient was the switch

al.z

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

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

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

Reply via email to