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
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Feb 08, 2008 6:54 pm   

Efficiency
 
Which would slow down a system more?

a. Long alias with a repeated long stringlist
b. Another variable (the stringlist)

also

a. Long alias with a repeated long routines
b. Another subroutine

I have a lot of subs being used two or three times, and some stringlists I could easily paste into aliases, though they would look bad. Overall speed isn't really important to me aside from being able to give the scripts to warrior forestals. They can't be bogged down.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Feb 09, 2008 1:27 am   
 
Because zMud uses an interpretted language you are generally better off breaking conditional parts out into subroutines. zMud actually copies the entire contents of an alias to another location in memory and preforms the %1..%99, %-1..%-99 replacements during that copy. Having the script in smaller blocks makes that copy faster. When an #IF skips past a section that was placed into another alias you have just saved the copy and replace time on that section entirely.

Also as a general programming rule speed is inversly proportional to memory usage when code requirements are the same. An aproximation of it is T=C/M. This would mean that if you can use more memory and keep the size of your code the same then it will go faster. As far as I can tell the passing of an actual string from an alias versus a variable reference to a function has the same speed in zMud. I really can't find a difference in them, which means that the variable will likely win because of my first statement about how zMud executes scripts.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 09, 2008 6:45 am   
 
Wow

That was much more then I expected. For a while I have wondered, even hoped, that the script did not include subs inside null conditionals. The inverse proportion is surprising. I wonder how this will effect my future scripts, still what I am feeling is relief.

Thank you.
Reply with quote
Arzoc
Beginner


Joined: 07 Jan 2008
Posts: 18

PostPosted: Mon Feb 18, 2008 8:23 pm   
 
Probably not the right place to ask, but it's such a small question I wouldn't bother making a new topic :
What do the %-1 , %-2 ,... mean? I understand %1 - %99 but that's about it.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Feb 18, 2008 8:31 pm   
 
%-1 is every parameter. %-2 is every parameter but the first. %-3 is every parameter but the first two. Basically, %n returns the nth parameter and %-n returns the nth parameter and all parameters following it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arzoc
Beginner


Joined: 07 Jan 2008
Posts: 18

PostPosted: Tue Feb 19, 2008 7:57 pm   
 
I understand! Thank you
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