Re: recursion testing (was: Finder - Delete empty folders,
Re: recursion testing (was: Finder - Delete empty folders,
- Subject: Re: recursion testing (was: Finder - Delete empty folders,
- From: Dave Stewart <email@hidden>
- Date: Tue, 15 Jun 2004 11:05:14 -0700
On Jun 14, 2004, at 10:00 PM, Ken Graff pounded mercilessly on his
keyboard and was surprised to discover:
Ok, I was bored... :-)
I decided to make a simple recursion test to see how many instances of
a handler could be opened. I came up with 284. I'm running a PowerMac
G5 dual 2 gHz, 1.5 GB RAM, Mac OS 10.3.4 with all updates, AppleScript
1.9.3, and Script Editor 2.0 (v43).
I'm on a older "Blue & White" G3, single 450MHz, 650MB RAM, OS 10.3.4
with most updates (I ignore the iSight junk I don't need), AppleScript
1.9.3. I ran your script in Smile 2.5.2 (I know ... it needs updating.)
Here's the script I used:
----
global totalRecurse
on recurse()
set totalRecurse to totalRecurse + 1
try
recurse()
on error
display dialog "failed at: " & totalRecurse
end try
end recurse
set totalRecurse to 0
recurse()
----
After a fraction of a second I get a dialog that says "failed at: 284"
Interesting ... I fail at 280. For some reason I thought your hotrod
machine would whip me silly here Ken, but it looks more like a language
thing.
This tells me that the deepest you can dig into a folder hierarchy
using a recursive algorithm is about 284 levels deep. I don't think
I've even had to dig that deep but I've definitely had recursive
algorithms fail on me so there may be some other limiting factor to
calling so many instances of handlers.
Adding this line to the recurse handler caused a failure at 265:
set variable1 to 1
Fails at 261 for me.
Additional variables caused the amount to keep falling:
2 248
245 for me, the rest also fail 3 iterations sooner than yours.
3 234
4 221
5 209
6 199
7 189
8 181
9 173
And so on. Saving the script as an application and running it made no
difference. The size and type of the additional variables didn't seem
to make a difference, although I wasn't too thorough in testing that.
Anyone else get anything different?
Aparently so, but not much different. I do have a number of programs
running at the time of the test (Mail, XCode, Terminal, Smile, iCal,
iRafas sorry I mean Safari, iChat), but I'll dare to guess that you
also had other programs running.
Absolute fixed stack size for AS?
Dave Stewart
Aqua~Flo Supply (Goleta CA)
dstewart at aquaflo dot com
I was told today that if you play a Windows 98 CD backwards, it plays
satanic messages. But I reckon that's nothing, if you play it
forward it installs Windows!
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.