Re: Why Slow Then Fast
Re: Why Slow Then Fast
- Subject: Re: Why Slow Then Fast
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 01 Mar 2011 23:00:51 +0100
Le 1 mars 2011 à 22:33, Luther Fuller a écrit : I first commented on this on Sep 7, 2010. Here is a new twist on the problem. (OS 10.6.6)
The original problem. ------------ I have an AppleScripted application bundle named "Write_Appls_Report". The script (about 90% removed) looks like this ... on main() -- opens a file to which the report is written -- writes install history to the file -- gets an alias list of applications in the applications folder (path to applications folder) as alias -- set appFolder to path to applications folder set applPosixList to my getApplsList(the result)
-- less than 1 second elapsed to get here
set itemNamesList to {} repeat with i from 1 to (count items of applPosixList) set applPosixPath to (item i of applPosixList) set itemNamesList to my formatAndWrite(applPosixPath, itemNamesList, leaders, fileRefNr) end repeat -- on first run this takes over 40 seconds
-- close the file end main -------------------------------------
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
Yvan KOENIG (VALLAURIS, France) mardi 1 mars 2011 23:00:40
|
_______________________________________________
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