miinx wrote (on 25.08.2006 05:28):
> Cüneyt wrote:
>> May I suggest, that you use Autorun list instead of HookWinodwsEvents.
>> HWE has more overhead compared to Autorun and increases CPU usage. I'd
>> use HWE only sparingly.
> Are you sure? I would have thought that since the Autorun list just
> passes the params of each window event to the hook script that it was a
> negligible difference..?
>
> Also, my HWE script is not long, with only 5 or so main events being
> watched for -- surely wouldn't take PP long to skim thru & say "not a
> match; not a match; not a match; yes a match!"..? There's only 4 lines
> it needs to read, PP doesn't delve deeper unless it finds a match..?
Yes, HWE is a cute, seamingly harmless feature, isn't it? But I don't
suggest HWE for 3 not-so-apparent reasons:
- Function or, as in PP terminology, script calls are always bound with
overhead, especially with variables passed by value. Besides, HWE is
called for every possible window event and for every window that's
created, i.e. you have to take this overhead into account for a huge
number of times. On my office PC with Intel 2.8GHz, I open my TaskInfo,
stop PP's Monitor list, and call this script from HWE:
@HWE_calls_this
Quit
This causes approx. 1.2% more CPU usage on the long run (average/25 sec)
if I work as usual, and more than 20% if I rapidly launch something
lightweight like win32pad multiple times, until PP crashes! Try it.
- PP does not use the so called shortcut evaluation in scripts, i.e.
even if the result of a condition is known, the remaining parts are
checked anyway. E.g.
If( 1==2 && [EMAIL PROTECTED] )
win.debug("I'm in")
Quit
@dummy
win.debug("roses are red")
Quit(0)
launches the debug window with roses. Why is this important? If you use
multiple conditions to narrow down your selection, you do actually
increase the overhead even more.
If you want to use HWE anyhow, at least move a part of the condition to
HWE in your pcf which can exclude most windows possible beforehand, e.g.
If(arg(2)=="XPCOM:EventWindow")
[EMAIL PROTECTED](arg(1))
- Last but not least, PP processes a caption list in C-speed, but HWE
must be processed in scripting speed (whatever that might be).
I know, the difference might not be big enough, but it becomes noticable
on dying laptops and VMwares. I hope this clarifies things a bit. As I
said, these are my observations and some educated guesses, Bruce has the
final word on these matters.
Peace,
Cüneyt
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/