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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ragautier
Beginner


Joined: 11 Aug 2007
Posts: 29

PostPosted: Wed Sep 12, 2007 5:44 pm   

[2.03] Severe trigger slow-down when pattern matching significant spaces
 
I created a trigger that matches text where whitespace is significant:

In my case
Code:
('Invisibility      ')

matching 'Invisibility' with 6 trailing spaces.

This was to ensure that 'Detect Invisibility' was not matched - the way it appears in the printout is such that the longer 'Detect Invisibility' can only ever have 4 spaces after it.

Any-who - when I added this trigger, it slowed down trigger processing whenever that trigger class is enabled. The slowdown seems to occur the first time the trigger is processed after waiting 2 minutes or so. If you enable that trigger class within a few seconds, there is no slowdown. But if you wait a while, and then (programatically) enable that trigger class containing that pattern, it slows down the MUD I/O severely as it tries to process that trigger set.

This behaviour was not present until I added this particular matching scheme.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Sep 12, 2007 6:25 pm   
 
I added a code tag to your post to preserve the spacing.

Check that the compiled pattern and the regex equivalent on the test trigger page aren't doing something weird. For me, that pattern doesn't compile.

You could probably use a regex to create a speedier pattern in the meantime.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Thinjon100
Apprentice


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: Wed Sep 12, 2007 6:57 pm   
 
I agree with Fang, you'll want to check the regex pattern that it's generating... it should be something like:
Code:

#REGEX {Invisibility\s{6,6}} {whatever}


That would match "Invisibility" followed by 6 spaces.

Or, if you want to get really rather advanced:
Code:

#REGEX {(?<!Detect\s)Invisibility} {whatever}


This will match "Invisibility" where it is NOT preceded by "Detect ".

Which of these executes faster in the regex engine, I don't know. The second example uses negative lookbehind, so it's possible CMud might not even compile it.
_________________
If you're ever around Aardwolf, I'm that invisible guy you can never see. Wizi ftw! :)
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Wed Sep 12, 2007 8:00 pm   
 
CMud doesn't (last I tried) do lookarounds. Which annoys me, but not enough to really complain.

You can just use "Invisibility {6}" though.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Sep 12, 2007 11:05 pm   
 
ragautier, is you are right, that was a good catch! I have noticed similar trigger slow-down and excessive CPU usage when parsing a single line of text from the MUD after a while of operation but hadn't yet tracked it down.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Sep 12, 2007 11:10 pm   
 
Having just started doing a bit of testing, CPU is a lot higher with the Package Editor open. ragautier, you may want to test with and without the Package Editor open...
Reply with quote
ragautier
Beginner


Joined: 11 Aug 2007
Posts: 29

PostPosted: Wed Sep 12, 2007 11:54 pm   
 
I came home and I'm not seeing the same slowdown -
btw: Invisibility{6} doesn't seem to match Invisibility followed by 6 spaces...what am I doing wrong?
For now I have it entered with the 6 spaces and the compiled says it's right...
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Wed Sep 12, 2007 11:57 pm   
 
It's not Invisiblity{6}, it's Invisiblity_{6} where _ is actually a space, heh. Make sure you tick the Regex box, too, of course.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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