Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ GetTriggerInfo Issue

GetTriggerInfo Issue

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Candido   USA  (78 posts)  Bio
Date Sun 15 May 2011 08:22 PM (UTC)
Message
Hello. I'm currently trying to optimize my Mushclient worlds by cracking down on the most time intensive triggers. I wrote a simple script to go through GetTriggerList() and divide GetTriggerInfo(x, 37), which is total time taken to match, by GetTriggerInfo(x, 38), the total number of attempts to match. This would give me the average time each trigger takes on each attempt, and I can just compare to find the worst.

However I started noticing some strange behavior, which is either a bug in Mushclient or a misunderstanding on my part. The triggers that floated to the top of my list claimed to have only attempted to match one time, yet their number of successful matches (trigger info 21) is higher than one. On any normal trigger this is impossible because an increment to 21 will also result in an increment to 38.

Luckily, it was easy to see what these 'one match' triggers had in common, which is that they all had expand variables checked and matched a variable in their regex, like @target.

What do you think?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Sun 15 May 2011 09:06 PM (UTC)

Amended on Sun 15 May 2011 09:07 PM (UTC) by Twisol

Message
I think I know exactly what you're talking about. When you have "Expand variables" checked, the trigger's regexp is recompiled and its total execution time is copied over. [1] The trigger itself contains the count of successful matches [2], while the regexp object contains the count of attempts [3]. What's happening is that the count of attempts isn't being copied over to the newly-compiled regexp, and the count of successful matches remains because it's in the trigger, not the regexp.


[1]: https://github.com/nickgammon/mushclient/blob/master/evaluate.cpp#L355-387
[2]: https://github.com/nickgammon/mushclient/blob/master/OtherTypes.h#L566
[3]: https://github.com/nickgammon/mushclient/blob/master/regexp.h#L51

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 15 May 2011 10:17 PM (UTC)
Message
Twisol is quite right. The time was saved but not the number of match attempts. Fixed in version 4.74.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Candido   USA  (78 posts)  Bio
Date Reply #3 on Sun 15 May 2011 10:27 PM (UTC)
Message
Awesome. Thanks!
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.


17,432 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.