Thread: Efficiency!
View Single Post
  #4  
Old 01-06-2007, 08:55 PM
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
In all technicality, example 2 is the most efficient in that it is not evaluating everything that is passed from ChatBar. However, it could still be improved, such as calling temp.toks[0].substring(1) only once and using a variable the multiple times it is needed. In all actuality, the substring isn't necessary.

Another note is I don't think example 2 is working like it is supposed to be, but that is merely speculation. If the serverside commands do not start with "/", they are not being evaluated in that example, and if they do begin with "/", then the "/" is being passed along to the server. Doesn't make much of a difference in script performance, but I must remind that removing the "/" from the command on the serverside as well is silly.

If example 1 could be tweaked to filter out non-commands from ChatBar, I would go with that one.
__________________
◕‿‿◕ · 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