Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
geosmith
Wanderer


Joined: 23 Apr 2005
Posts: 57

PostPosted: Sat Aug 13, 2005 3:01 am   

Tips for Efficiency?
 
I realise this is going to sound impossibly vague, but are there any particular commands or functions which should be avoided in order to squeeze the fastest possible response-time out of zMUD? I know using wildcards such as * in triggers slows things down considerably, and I heard that gagging lines of text does also, but any suggestions beyond this?

Perhaps one of you could take a few moments to jot down a few scripting 'best practises' / pitfalls for those of us looking to further our knowledge and avoid picking up bad habits along the way?

Much appreciated if so.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Aug 13, 2005 5:27 pm   
 
1)where possible, use text instead of wildcards in trigger patterns.

2)avoid recursive activities (this is a powerful feature, to be sure, but recursion is extremely slow). Perhaps the most horrible example is the use of several %replace() functions to edit a variable in one line:

Variable = %replace(%replace(%replace(%replace(%replace(@Variable,"what to find","what to change it to"),"what to find","what to change it to"),"what to find","what to change it to"),"what to find","what to change it to"),"what to find","what to change it to")

If you have no choice but to do something like this, split it up so there's only 1-3 or even just one replace per assignment or perhaps banish the whole thing to a plugin.

3)unroll the loops (this is a standard optimization trick and is not exclusive to zmud). This is really reserved for extremes, as this trick comes from the days when computers were really slow and lacking and every last bit was too valuable to waste. However, if you can do something without a loop just as easily as with, go without.

4)Where possible, use literals instead of variables or functions. Using variables or functions means ZMud has to do more processing and more processing means a slowdown (which could be noticeable).
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net