[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fly in from right banner



John, FYI and FWIW Departments:  I came up with the following test script to
see if setTimeout acted recursively.  Though this is not a definitive test,
I think it points in a strong direction: setTimeout does NOT set up a
recursive loop.  Here's the test script.  When I ran it, I consistently got
507 loops for the stack test before JavaScript pooped out a stack overflow
error.  I got over 10,000 loops for the setTimeout test (I spun the mouse to
get the interval to a little faster, and my arm, got too tired!), and didn't
get an error at all.  I'd be interested in the results of others.  For
tabulation purposes, I'm using Windows 95.

(FWIW II: I just realized you can just depress the mouse button to get the
timer to fire more quickly.  I had forgotten this generates HITTEST mouse
messages in Windows, and it does the same thing as moving the mouse.  Gad,
and after such a bad case of carpel tunnel syndrome!)

<HTML>
<HEAD>
<TITLE>Gordon's McComb's Funky Stack/setTimeout Test</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var Count = 0;

function doSomething1() {
	document.myform.textbox1.value = Count++;
	setTimeout ("doSomething1()", 1);
}

function doSomething2() {
	document.myform.textbox2.value = Count++;
	doSomething2();
}

</SCRIPT>
<BODY>
<FORM NAME="myform" METHOD=get ACTION="test1.html">
setTimeout iterations: <INPUT TYPE="text" NAME="textbox1" Value="0"> 
<INPUT TYPE="button" VALUE="setTimeout Test" onClick="Count = 0;
doSomething1()"><P>
JavaScript blew its stack at: <INPUT TYPE="text" NAME="textbox2" Value="0"> 
<INPUT TYPE="button" VALUE="Stack Test" onClick="Count = 0; doSomething2()"><BR>
</FORM>
</BODY>
</HTML>

-- Gordon

At 06:08 PM 2/28/96 +0000, you wrote:
>I have not tested this particular site but one of the problems with 
>banner routines/functions is they require endless recursion. This is 
>due to the current limited number of RT (real time) event handlers in 
>JavaScript. The most reliable types are ones the do not pass 
>arguments to the functions (Mr Stack... say hello to Mr Heap).
>I have seen some that will run on a Windows 8meg platform for less 
>than 10 minutes. And of course if they are really screwed up, just 
>loading them might cause a problem. Obviously the lastest version of 
>Netscape SHOULD be better. However, I have found, as with all complex 
>applications, as one thing is fixed something else is broken.
>
>Hey Netscape (dev/null) how about some real event handlers like:
>whileMouseOver();
>whileFocus();
>timers that are accurate at times below 150ms (say down to 20-30ms)
>resetTimeout(id);  for imediate reuse at the selected ms delay.
>etc.
>John

--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/