Thread: Efficiency!
View Single Post
  #11  
Old 01-07-2007, 05:32 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
Thus the major thing I've been wondering about. I was thinking cases would be similar to checking an array for a match since it's only comparing the case "blah": line. I think it would be very close in terms of efficiency. You could argue that once a match is found serverside, it has to go through all cases below it but does it actually process cases since it has found it's match already?

Also, my method doesn't send incorrect commands serverside . Kuji would need another .index() for this thus less efficiency clientside .
No, it stops processing cases after it has found a match and runs the code held therein regardless of case (that is, without breaking the loop). I agree in that they are close in efficiency, however from the post, #2 is still more efficient. And as I stated in my first post, simple changes could make both even better, eventually making #1 the more efficient.

An array would do the trick.
__________________
◕‿‿◕ · 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