I would recommend polling once every second. Do you really need instantaneous reactions? Also, you shouldn't pass a string to setTimeout.
Instead, you should pass the function itself, like htis: setTimeout(pollForEvents, 1000).
When the user clicks something in the ActiveX object, I'd like the other stuff on the page to respond to that user input 'apparently instantaneously' (so a small fraction of a second). – ChrisW Aug 29 '10 at 21:22 For one thing, I believe that anything more frequent will interfere with power-saving mechanisms. – SLaks Aug 29 '10 at 21:25 "Do you really need instantaneous reactions?
" Normally when I write a UI, I design/prefer it to be quick/responsive. Otherwise the user clicks something, nothing happens, and they're like "? ".
– ChrisW Aug 29 '10 at 21:26 I can see that you might be be right, theoretically; but my limited Googling hasn't uncovered mention of a direct relationship between the settimer interval and reducing power.My uninformed guess would have been that power-saving is controlled by the average CPU utilisation (and the average utilisation seems to be low-ish, even at 100msec, at least on my machine). – ChrisW Aug 29 '10 at 21:44 @ChrisW: msdn.microsoft. Com/en-us/library/ms182230.
Aspx – SLaks Aug 29 '10 at 22:12.
Start with 1 second, then, see how your response is. If you need it faster, decrease the timeout period, but, you may find that below 20-50ms you won't get any improvement, due to the OS, and timeslicing, so threads can get adequate time. I doubt you will see much cpu utilization, if you are not doing much, as, if it takes 1ms for it to do the operation, and it could be faster, then you spend most of your time sleeping, for this.
But, it really comes down to the user experience, and that is subjective. What may be acceptable to one person may seem slow to someone else. So, find what you think is an appropriate value, then ask friends to try it and see what they think of the response.No point going faster just because you can, if there is no benefit.
100 msec is effectively instantaneous (less than the human eye-hand reaction time), 200 msec is quick but noticeable, and 1000 msec is entire heartbeat or even longer. Do you foresee any trouble with 100 msec? – ChrisW Aug 29 '10 at 21:50 @ChrisW - I have used 50ms without any problems, and for some browsers I have used 20ms without any issues, so 100ms should be fine, but, it will depend on what else is going on with the page.
For example, a 1 second timer would only need to be about 500ms, for accurate time keeping. – James Black Aug 29 '10 at 21:57 OK, thank you. My preference would have been an event handler instead of polling; but the .
NET security won't let me call from within the object across the ActiveX interface (I suppose it doesn't know that what's running on the other side of the interface is 'safe' JavaScript, and not unmanaged code). – ChrisW Aug 29 '10 at 22:05.
It depends on - how fast you want the ActiveX object to respond. - other factors that keep the CPU busy (flash animations, other polled functions) Interval values don't reflect the actual values because of other factors. So, in your machine lower values can seem right but you can't be sure of the certainty at ohther clients.
I recommend you to increase the interval as much as you can. If one second is adequate, that's fine.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.