|
Spyrel Newbie
Joined: 12 Apr 2004 Posts: 1
|
Posted: Mon Apr 12, 2004 8:15 am
Parsing and the speed thereof |
I PK on a mud that requires me to be quick on the reaction, so I use triggers and the such, and therefore use Zmud (as if there was another choice). </suckingup>
The question I have is in regards to speed. I know that computer specs make a difference in ultimately how fast any given script will run, but as far as Zmud code is concerned, which is faster?
Fewer dynamic triggers relying more on parsing various things (I.E.: Blahblah, nearby to the &{direction}.) or more specific triggers with specific commands attached {I.E.: Blahblah, nearby to the west. -> dash west backstab blahblah}?
Furthermore, what kinds of things can I do to add more flexibility to my scripts, yet keep them running efficient? IE, disabling specific triggers, disabling classes of triggers, or parsing checks inside the triggers (cases and the such to determine how to fire).
(*crosses fingers and hopes people understand what is being asked*) |
|
|
|
Greendale Beginner
Joined: 19 Mar 2004 Posts: 17 Location: Sweden
|
Posted: Mon Apr 12, 2004 1:59 pm |
I ran some tests a couple of weeks ago and found that making trigger case sensitive or verbatim makes them faster. Some 25% in my tests, IIRC. This was with REGEX by the way.
I though for sure putting a ^ at the beginning of all triggers that match from the beginning of the line would make a difference, but I could detect no speed improvement at all.
Turning off trigger on trigger didn't do anything either.
About dynamtic triggers. If you have gauges or a status window, every time you change the value of an variable these will be updated, and this takes considerable time. I found that this affected the speed of my setup more than anything else I could come up with.
Also remember that ALL code takes time to run. For example:
Code: |
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#IF (0) {
#NOOP
#SAY Hey!
#NOOP
}
#NOOP
}
#NOOP
}
#NOOP
}
#NOOP
}
#NOOP
}
#NOOP
}
|
That takes five times as much time to execute as this:
Code: |
#IF (0) {
#NOOP
#SAY Hey!
#NOOP
}
|
Even though in both cases the first #IF is false and the code after should be skipped. That is the price you pay for interpreted (non compiled) code I guess. |
|
|
|
|
|
|
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
|
|