brucexs wrote:
> I don't plan on this. Write the .log script instead. It would keep
I'm cool. Yes, a log script holding a map of 'allowed writers' and their
'debugging properties' is the most
flexible solution.
> If it is too slow,
Before taking the plunge, I ran some rough tests (script attached). They lead
me to believe that
performance-wise the best solution is to stick to if(DEBUG) win.debug() and be
happy with it!
Here's some detail to back up my statement (rough figures, take with a grain of
salt):
Fastest method for production scripts (unpaused debug window):
static DEBUG=0
if(DEBUG)
win.debug(...)
which is 15x faster than calling a hypothetical log script label (5776/377=15
5899/379=15)
calling a log plugin (simulated with win.hex(0) paused debug window)
wouldn't be faster, if fact about ~20% slower (5673/3971=1.2 5749/4003=1.2)
currently, pausing the debug window yields a ~2x speed improvement. Note: even
when paused, the
top field of the debug window is still updated.
--sgp
--- script follows with performance figures (same figures that are cited above)
---
; scriptname == "debug"
@performance_test
local delta=5
local i,t0,t1
local j=0
local e=vec.create(10)
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
endfor
e[j]="i=i+1 "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
win.debug(i)
endfor
e[j]="win.debug(i) "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
if(0)
win.debug(i)
endfor
e[j]="[NOW PRODUCTION]if(0)win.debug() "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
if(1)
win.debug(i)
endfor
e[j]="[NOW DEBUGGING]if(1)win.debug() "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
[EMAIL PROTECTED](0,i)
endfor
e[j]="[EMAIL PROTECTED]>if(0)win.debug(i) "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
[EMAIL PROTECTED](1,i)
endfor
e[j]="[EMAIL PROTECTED]>if(1)win.debug(i) "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
[EMAIL PROTECTED](0,i)
endfor
e[j]="[W/LOGSCRIPT [EMAIL PROTECTED]>if(0)win.debug(i) "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
win.hex(0)
endfor
e[j]="[~PLUGIN PRODUCTION]win.hex(0) "++i
j=j+1
t1=timesec+delta
i=0
for(t0=timesec;t0<t1;t0=timesec)
i=i+1
[EMAIL PROTECTED](1,i)
endfor
e[j]="[W/LOGSCRIPT [EMAIL PROTECTED]>if(1)win.debug(i) "++i
j=j+1
t0=e[0]
for(i=1;i<vec.length(e);i=i+1)
t0=t0++" "++e[i]
endfor
win.debug(t0)
messagebox("ok",t0)
quit
/*
Results (winxp sp2):
delta=5 debug window unpaused
C: drive
--------
i=i+1 5382 win.debug(i) 819 [NOW PRODUCTION]if(0)win.debug() 5776 [NOW
DEBUGGING]if(1)win.debug()
808 [EMAIL PROTECTED]>if(0)win.debug(i) 377 [EMAIL PROTECTED]>if(1)win.debug(i)
270 [W/LOGSCRIPT
[EMAIL PROTECTED]>if(0)win.debug(i) 377 [W/LOGSCRIPT [EMAIL PROTECTED]>if(1)
win.debug(i) 271
Ram drive
---------
i=i+1 5885 win.debug(i) 707 [NOW PRODUCTION]if(0)win.debug() 5899 [NOW
DEBUGGING]if(1)win.debug()
819 [EMAIL PROTECTED]>if(0)win.debug(i) 380 [EMAIL PROTECTED]>if(1)win.debug(i)
272 [W/LOGSCRIPT
[EMAIL PROTECTED]>if(0)win.debug(i) 379 [W/LOGSCRIPT [EMAIL PROTECTED]>if(1)
win.debug(i) 256
delta=5 debug window paused
C: drive
--------
i=i+1 4899 win.debug(i) 2092 [NOW PRODUCTION]if(0)win.debug() 5749 [NOW
DEBUGGING]if(1)win.debug
() 2266 [EMAIL PROTECTED]>if(0)win.debug(i) 304 [EMAIL
PROTECTED]>if(1)win.debug(i) 279 [W/LOGSCRIPT
[EMAIL PROTECTED]>if(0)win.debug(i) 286 [~PLUGIN PRODUCTION]win.hex(0) 4003
[W/LOGSCRIPT [EMAIL PROTECTED]>if(1)win.debug(i) 279
Ram drive
---------
i=i+1 5504 win.debug(i) 2087 [NOW PRODUCTION]if(0)win.debug() 5673 [NOW
DEBUGGING]if(1)win.debug
() 2265 [EMAIL PROTECTED]>if(0)win.debug(i) 301 [EMAIL
PROTECTED]>if(1)win.debug(i) 278 [W/LOGSCRIPT
[EMAIL PROTECTED]>if(0)win.debug(i) 301 [~PLUGIN PRODUCTION]win.hex(0) 3971
[W/LOGSCRIPT [EMAIL PROTECTED]>if(1)win.debug(i) 277
Conclusions (rough figures, take with a grain of salt)
------------------------------------------------------
Fastest method for production scripts (unpaused debug window):
static DEBUG=0
if(DEBUG)
win.debug(...)
which is 15x faster than calling a script label (5776/377=15 5899/379=15)
calling a log plugin (simulated with win.hex(0) paused debug window)
wouldn't be faster, if fact about ~20% slower (5673/3971=1.2 5749/4003=1.2)
currently, pausing the debug window yields a ~2x speed improvement. Note: even
when paused, the
top field of the debug window is still updated
*/
@here
if(arg(1))
win.debug(arg(2))
quit
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/JV_rlB/TM
--------------------------------------------------------------------~->
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/