|
geosmith Wanderer
Joined: 23 Apr 2005 Posts: 57
|
Posted: 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. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
|
|
|
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
|
|