Re: Why Slow Then Fast
Re: Why Slow Then Fast
- Subject: Re: Why Slow Then Fast
- From: Luther Fuller <email@hidden>
- Date: Tue, 01 Mar 2011 16:18:22 -0600
On Mar 1, 2011, at 4:00 PM, KOENIG Yvan wrote: I guess that the problem may be to the fact that you pass the list to the handler formatAndWrite on each call. I assume that editing this handler so that it just build a new item descriptor and return it would be more efficient :
set itemNamesList to {} repeat with i from 1 to (count items of applPosixList) set applPosixPath to (item i of applPosixList) copy my edited_formatAndWrite(applPosixPath, leaders, fileRefNr) to end of itemNamesList end repeat
Can't do that. The repeat ... end repeat loop used to be a recursive handler. This has been replaced with a "recursive variable", itemNamesList which must be passed to the formatAndWrite handler, modified by that handler, then passed to the next call to formatAndWrite . (Or, I could have made itemNamesList a global recursive variable.)
The previous, recursive, handler had the "slow, then fast" problem, too.
(And I could have put the handler code in the body of the repeat ... end repeat loop, but calling a handler avoids problems caused by AppleScript's lack of a 'next repeat' command.)
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden