Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
AW: [Flashcoders] Switch/Case vs If/else

AW: [Flashcoders] Switch/Case vs If/else

2004-02-11       - By Mees, Stefan

 Back
Reply:     1     2     3     4     5     6  

I had at this time no flasm by hand - so i can 't say i 'm 100% sure

-- --Ursprüngliche Nachricht-- --
Von: Ladislav Zigo [mailto:lacoz@(protected)]
Gesendet: Mittwoch, 11. Februar 2004 14:14
An: flashcoders@(protected)
Betreff: Re: [Flashcoders] Switch/Case vs If/else


are you sure? for me is switch faster...
-- -- Original Message -- --
From: "Mees, Stefan " <Stefan.Mees@(protected) >
To: <flashcoders@(protected) >
Sent: 11. februára 2004 14:42
Subject: AW: [Flashcoders] Switch/Case vs If/else


<code >
switch(bla) {
case 1 : doSomeThing1(); break;
case 2 : doSomeThing2(); break;
default: doNothing();
}
</code >

is the same code bytecode than

<code >
if(bla === 1) {
doSomeThing1();
} else if (bla === 2) {
doSomeThing2();
} else {
doNothing();
}
</code >
the only difference is the first one looks nicer ;-)




-- --Ursprüngliche Nachricht-- --
Von: Ilja Goossens [mailto:ilja.goossens@(protected)]
Gesendet: Mittwoch, 11. Februar 2004 13:33
An: flashcoders@(protected)
Betreff: RE: [Flashcoders] Switch/Case vs If/else


sorry 'almighty ' keith...

:P


-- --Oorspronkelijk bericht-- --
Van: Keith Peters [mailto:flashcoder@(protected)]
Verzonden: woensdag 11 februari 2004 13:19
Aan: flashcoders@(protected)
Onderwerp: RE: [Flashcoders] Switch/Case vs If/else


Please don 't give ideas or opinions on how commands work. They either
work a certain way or they work another way.
If you KNOW how they work, please share. If you just THINK they work
that way, it 's not very helpful.

As for the original question, you can test the speed of any function
yourself.

startTime = getTimer();
for(var i=0;i <1000;i++){
// test a switch statement here
}
trace(getTimer() - startTime);

startTime = getTimer();
for(var i=0;i <1000;i++){
// test an equivalent if statement here
}
trace(getTimer() - startTime);

Run it several times to be sure.

Then you will KNOW.

> -- --Original Message-- --
> From: Ilja Goossens [mailto:ilja.goossens@(protected)]
> Sent: Wednesday, February 11, 2004 6:52 AM
> To: flashcoders@(protected)
> Subject: RE: [Flashcoders] Switch/Case vs If/else
>
>
> I think the difference is that every condition in the if/else
> gets evaluated And a switch knows wich case has to be
> performed, without evaluating them each time.
>
> So I think the switch will be faster as the amount of
> cases/elses increases
>
> -- --Oorspronkelijk bericht-- --
>
>
>
> i think to remember that switch/case is in byte code the same
> result than If/Else... the only difference is better looking
> source code.. Best, Stefan
>
>
>
> -- --Ursprüngliche Nachricht-- --
>
>
>
> Is switch/case faster than if/else?
>
> - Andreas SJ
>
>
>
>
>
>
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
> -- ------
> Supported by Fig Leaf Software
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
> -- ------
> Be sure to check the archives and the wiki:
> http://chattyfig.figleaf.com/
>
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
> -- ------
> http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103775
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
> -- ------
> To unsubscribe send a blank e-mail to:
> Normal Mode: flashcoders-unsubscribe@(protected)
> Digest Mode: flashcoders-digest-unsubscrive@(protected)
>
>
>
>



=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103780
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)




=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103781
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)



=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103783
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)



-- ---- --
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Skontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 6 - stiahnite si pomocnika pre digitalnu fotografiu
(http://www.zoner.sk/zme6)






-- ---- --
* www.inMail.sk - Vasa emailova adresa na cely zivot ZDARMA
* Mail neobsahuje virusy. Skontrolovane antivirusom NOD32 (www.eset.sk)
* www.SlovakNET.sk - profesionalny webhosting, domena .SK ZADARMO
* Zoner Media Explorer 6 - stiahnite si pomocnika pre digitalnu fotografiu
(http://www.zoner.sk/zme6)


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103785
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)



=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:103787
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)