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
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Tue May 19, 2009 6:20 pm   

Whoho! faster buttons!
 
Here is what I ended up with to test a lil on button speed, ran into some interesting results.

first.... the code:
Code:
<alias name="createbut" language="Lua" id="40">
  <value>local startt=os.time()*1000+zs.func.time("z")
for x = 0,4 do
  for y = 0,4 do
  _= zs.makebutton{name=tostring("but"..x.."_"..y), butw="30", buth="30",offcaption=tostring(x*y),  butl=tostring(x*30),butt=tostring(y*30),  autosize="false",autopos="false",  panelnum="0",class="buttest"  }
 
  end -- end y
end --end x
local endt=os.time()*1000+zs.func.time("z")
print("run time = "..tostring(endt-startt))</value>
</alias>
<alias name="editbut" language="Lua" id="61">
  <value>local startt=os.time()*1000+zs.func.time("z")
for i = 1,10000 do
local y = tostring(math.random(5)-1)
local x = tostring(math.random(5)-1)
but = zs.getbutton("but"..x.."_"..y)
but.transparent="false"
but.color = math.random(536870911)
if (but.butt > 299) then but.butt = but.butt-300 else but.butt = but.butt+300 end
end -- end do loop

local endt = os.time()*1000+zs.func.time("z")
print("run time = "..tostring(endt-startt))</value>
</alias>


Two aliases, 1 to make buttons, other to edit color/position. Started out in 3.07 because that's what I had open.

First thing I noticed was the script was returning the time long before the buttons were fully displayed so I added the timestamp to the window and put test in command line with the PE open, and staying on top, using the execute script with the mouse I could then start the script and send text to the window to get a rough idea of when the buttons were finished displaying.

For creating the buttons, I ended up with a script time of 180-220 ms and a display time of another 6 or 7 seconds.
Editing the buttons, a script time of 2100-2500 ms, and a display time of 2-5 seconds.


For 3.06
Creating buttons, script time about, 1200-1600 ms but.. a display time of just under that of 307, 4-5-6 seconds,
Editing buttons... was scary, script time ran from 20k to 35k ms, with a display time of a couple seconds.

So... I'ld have to say some VERY significant performance changes were made, Great job Zugg.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue May 19, 2009 6:54 pm   
 
Yeah, that makes good sense, and thanks for the speed test. One big change in 3.07 is that the buttons are now updated by sending a Windows "update" message to the buttons from whatever thread the script is running in. So your script finishes before this "update" message is ever executed. That detaches the button update from the script itself. CMUD executes the button "update" message in the main thread when it gets around to it, but doesn't stop your script execution while it's updating.

So it would make sense that the display times would be the same (none of that code really changed much).

Great to see that it made such a huge different on the scripts. The Creating Buttons time was especially interesting to me since that should reflect the improvements in database and property handling and not so much about the button "update" improvements.

Nice to see that everything stills works from Lua too :)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Tue May 19, 2009 7:16 pm   
 
Zugg wrote:
One big change in 3.07 is that the buttons are now updated by sending a Windows "update" message to the buttons from whatever thread the script is running in. So your script finishes before this "update" message is ever executed. That detaches the button update from the script itself. CMUD executes the button "update" message in the main thread when it gets around to it, but doesn't stop your script execution while it's updating.


The question is: will Windows "eat" multiple update messages like it does with "paint" messages? wrym wrote that it takes around 2-5 seconds for CMUD to complete drawing... Will we have a command that will force immediate button update/redraw? Enhanced #UPDATE?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue May 19, 2009 7:52 pm   
 
Yes, it does "eat" multiple update messages, like with paint. However, the #UPDATE command already forces an immediate button redraw.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Tue May 19, 2009 8:16 pm   
 
Cool! Very Happy Great job, Zugg!
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
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