Thread: Efficiency!
View Single Post
  #6  
Old 01-07-2007, 05:14 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Twinny View Post
When you think about it, it's very similar to if/else. Starts at the first case and checks. If it's the case, it performs it then ends the whole script. If not, goes down. Once it meets it's case, doesn't have to evaluate any others.For the serverside part, it's just reading the case "example": but i'm not even sure if it's doing that =p
I know what switch does, and I would argue that it's not particularly similar to if/else.

What I was getting at is that say ChatBar calls onAction. The second one is weeding out right off the bat all parameters from ChatBar that could never be the case. Option one loops through each of the cases for everything passed from ChatBar, regardless of if it might be a case. That is not particularly desired; it runs up CPU usage.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote