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
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Mon Oct 13, 2008 9:46 pm   

[2.36] terrible gauge performance
 
<trigger name="ID_STATS" priority="220" case="true" trigontrig="false" regex="true" id="22">
<pattern>^{stats}(?prompt.str:\d+)\/(?prompt.basestr:\d+),(?prompt.int:\d+)\/(?prompt.baseint:\d+),(?prompt.wis:\d+)\/(?prompt.basewis:\d+),(?prompt.dex:\d+)\/(?prompt.basedex:\d+),(?prompt.con:\d+)\/(?prompt.basecon:\d+),(?prompt.luck:\d+)\/(?prompt.baseluck:\d+),(?prompt.hpp:\d+),(?prompt.mpp:\d+),(?prompt.mvp:\d+),(?prompt.hr:\d+),(?prompt.dr:\d+),You are (?prompt.text:.*)\.,(?prompt.enemypct:\d+),(?prompt.hp:\d+)\/(?prompt.maxhp:\d+),(?prompt.mp:\d+)\/(?prompt.maxmp:\d+),(?prompt.mv:\d+)\/(?prompt.maxmv:\d+),(?prompt.gold:\d+),(?prompt.qp:\d+),(?prompt.tp:\d+),(?prompt.align:-?\d+),(?prompt.tnl:\d+),(?prompt.level:\d+),(?prompt.pos:\d+)$</pattern>
<value>//#TAG prompt
#GAG
#SA debug @tshow(@prompt.time)</value>
</trigger>

exactly same pattern on zmud processes below %time division range (says 16ms) with decent number of conditionals in it, on this raw trigger cmud takes 230-250ms

easy to test on aard

edit: changed thread title to reflect following discoveries


Last edited by intoK on Tue Oct 14, 2008 10:22 am; edited 1 time in total
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Oct 14, 2008 10:03 am   
 
You must have some other settings that are causing this problem. I put your trigger into a blank session and then used this at the command line to time and test it.
Code:
$x=%secs;#SHOW "{stats}123/123,123/123,123/123,123/123,123/123,123/123,123,123,123,123,123,You are abc 123 xyz.,123,123/123,123/123,123/123,123,123,123,-123,123,123,123";#SHOW (%secs-$x)
The timings I got were 44, 22, 23, 23, 23, 22, 23, 24, 25. The 44 is from the creation of the variable. I then added clearing of the variable so that all of its fields would have to be repopulated, and received consitent timing around 35.

Edit: removed bad test procedure, so no one would try it and get false results.
_________________
The only good questions are the ones we have never answered before.
Search the Forums

Last edited by Vijilante on Tue Oct 14, 2008 11:07 am; edited 1 time in total
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Tue Oct 14, 2008 10:20 am   
 
indeed, on blank session i oscillate around 20ms...

after disabling 4 gauges time dropped to circa 95ms

disabled every other possible thing in that session except this trigger, still 95
this turned this session basically raw, with 3 capture windows and mapper open, no settings for capture windows btw

how on earth 4 gauges are causing 150ms lag, zmuds gauges dont impact performance at any measurable scale

update: restarted cmud with all above disabled, times out at 20... will investigate
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Tue Oct 14, 2008 10:36 am   
 
ok, reenabling those 4 gauges bumped timing back to 230+
redisabling dropped back to 90, id assume restarting session will clear it back to 20

gauges are as basic as they get:
<button name="bu_hp" type="Gauge" autosize="false" width="200" height="19" autopos="false" inset="true" toolstyle="true" transparent="false" color="lime" textcolor="#000040" gaugelowcol="yellow" gaugebackcol="#D1CFC5" priority="102" id="9">
<caption>HP @prompt.hp (@prompt.hpp%)</caption>
<expr>@prompt.hpp</expr>
<gaugemax>100</gaugemax>
<gaugelow>33</gaugelow>
</button>
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Oct 14, 2008 11:18 am   
 
I used 4 copies of your guage to replicate your results. There appears to be some room for Zugg to optomize things here.

To explain what is making it so slow, button captions are compiled and generate a list of variables that they should watch for updates to. Your guages are watching for the "prompt" variable to change and individual fields in the variable. Your trigger actually changes the variable 32 times if every field has changed. The testing procedure I was using does indeed force 32 updates of the variable. This was causing each of your guages to update 32 times.

Next is the disabled issue. Having them disabled at the start of the session causes them to never compile and register thier interest in the "prompt" variable. Once they are enabled the need to check thier state for each update of "prompt" is recorded. Disabling the button after that doesn't remove the need to check its state. This is something Zugg might improve.

Anyhow the way to fix your trigger is to make it so only 1 update of the "prompt" occurs.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="ID_STATS" priority="10" case="true" trigontrig="false" stop="true" regex="true" copy="yes">
    <pattern>^{stats}(\d+)\/(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),You are (.*)\.,(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+)\/(\d+),(\d+),(\d+),(\d+),(-?\d+),(\d+),(\d+),(\d+)$</pattern>
    <value>#TAG prompt
#GAG
#SAY debug
$names="str|basestr|int|baseint|wis|basewis|dex|basedex|con|basecon|luck|baseluck|hpp|mpp|mvp|hr|dr|text|enemypct|hp|maxhp|mp|maxmp|mv|maxmv|gold|qp|tp|align|tnl|level|pos"
$prompt=""
#LOOP %numitems($names) {
 $prompt=%concat($prompt,"|",%item($names,%i),"=",%param(%i))
}
#ADDKEY prompt {%right($prompt,1)}</value>
  </trigger>
</cmud>
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Oct 14, 2008 11:56 am   
 
Personally, I use the following set up:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="15420" copy="yes">
    <pattern>^~{stats~}(*)</pattern>
    <value>#gagspace
#VAR statline {%subchar(%1, "/,","||")}</value>
  </trigger>
</cmud>


Then I just use %item(@statline, 1) for whatever I may need it for. Doing this has brought my speed (even with 4 gauges) down to an average of 10. To show an example of one of my gauges, here's a copy of one:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <button type="Gauge" autosize="false" width="100" height="23" autopos="false" left="200" toolbar="2" toolstyle="true" transparent="false" color="#008040" textcolor="silver" gaugelowcol="navy" priority="63200" copy="yes">
    <caption>Enemy: %if(%item(@statline, 19)=9999, 0, %item(@statline, 19))%</caption>
    <expr>%if(%item(@statline, 19)=9999, 0, %item(@statline, 19))</expr>
    <gaugemax>100</gaugemax>
    <gaugelow>10</gaugelow>
  </button>
</cmud>


Just a thought on optimization...

Charneus

Edited to change replaces to %subchar.


Last edited by charneus on Tue Oct 14, 2008 1:34 pm; edited 1 time in total
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Tue Oct 14, 2008 12:53 pm   
 
aah, thanks guys! both viable ideas, i will commence experimentation Very Happy

vij, this mechanics might also explain when i tried to implement sort of threading in zmud using expression triggers, obviously in my undying love of non cluttered settings everything was keys
and things got unbearably sluggish in no time Cool

charneus, excellent idea for (not) parsing stats, id change those replaces for one subchar tho

issue remains, buttons/gauges (and if that hasnt changed since zmud - exp triggers) watch whole variable instead specific keys
implementing might be little trickier due to nature of hash tables tho, depending on implementation...
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Tue Oct 14, 2008 2:01 pm   
 
charneus, also fighting mobs with , in name will corrupt reminder of @statline
id suggest changing pattern to ^{stats}(.*)You are (.*)\.(.*)$
and parsing by statline=%subchar(%1,"/,","|")%2%subchar(%3,"/,","|")
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