Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Oligo
(26 posts) bio
|
| Date |
Sat 09 Jun 2012 02:38 PM (UTC) [ quote
] Amended on Sat 09 Jun 2012 02:41 PM (UTC) by Oligo
|
| Message |
I'm trying to port some string subs from Tintin to Mush but I've noticed some pretty significant performance degradation. I suspect it has to be with the way I setup the regex. I have roughly 100 of these spell subs.
In Tintin, the syntax I use is like
#sub {%1 wooden splint} {$1 wooden splint [LOW HEA]}
In Mush, I couldn't figure out an exact 1-to-1 match to the tintin #substitute command so I use a trigger with omit output to mimic #sub behavior. I do the following which seems to have heavy performance penalty. If I add an anchor ^ at the beginning of the pattern will that help performance? Or is there a more robust way or better technique to what I'm doing?
<trigger colour_change_type='1' enabled='y' expand_variables='y' group='spellcomps'
match="(.+) wooden splint(.*)" omit_from_output='y' regexp='y'
send_to='12' sequence='100' other_text_colour='white'>
<send>ColourNote("silver","black","%1 wooden splint [LOW HEA]%2")</send>
</trigger>
Ideally if I encounter something like
A wooden splint is here. [2]
I'd like the sub to replace it with
A wooden splint [LOW HEA] is here. [2]
|
mud.arctic.org : 2700 | top |
|
| Posted by |
Nick Gammon
Australia (18,769 posts) bio
Forum Administrator |
| Date |
Reply #1 on Sat 09 Jun 2012 09:13 PM (UTC) [ quote
] |
| Message |
The anchor may help, to save it having to keep retrying a match from position 1, position 2 and so on.
What will probably also help is uncheck "expand variables". Variables are where variable substitution is done, which you are not doing. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
660 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )