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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
raviden
Novice


Joined: 02 Nov 2010
Posts: 45

PostPosted: Sat Nov 26, 2011 2:15 pm   

Efficiency question
 
Hey,

Which of following is better in efficiency sense?

Creating 3 triggers, with patterns that differ slighly but their command line does exacly what it should.

Creating one trigger that is general enough to catch all those three different patterns and then uses %match inside to choose which command line should it proceed.

Thanx, cheers
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Sat Nov 26, 2011 5:16 pm   
 
separate more precise triggers are faster in most cases
but unless your script is excessively complex, you likely wont be able to tell a difference
_________________
Discord: Shalimarwildcat
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Nov 26, 2011 5:44 pm   
 
Between the 2 choices you gave the use of 3 triggers will be faster. This is because %match will have to build extra data to test the patterns each time.

For some complex patterns a speed gain can occur by making a general pattern that uses specific captures to tell the script what to do. This becomes faster because the captures become the things tested by the script, and those tests can be done faster then matching from the start of the line again.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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