Re: Slow Command in Snow Leopard
Re: Slow Command in Snow Leopard
- Subject: Re: Slow Command in Snow Leopard
- From: Axel Luttgens <email@hidden>
- Date: Wed, 7 Apr 2010 13:41:32 +0200
Le 6 avr. 2010 à 22:02:05, Luther Fuller a écrit :
> This is a follow-up to yesterday's comments. I was curious just how fast one could count the files in a folder. I hadn't yet tried System Events, so I created a test folder containing 532 files and compiled each of these scripts to an applications with ASE ...
>
> [...]
>
>
> And the results:
> ls --------------> about 1 sec
> Finder -----------> 10 sec
> System Events ----> 26 sec
>
> If you double the size of the test folder, Finder and System Events simply render the system inoperable. You'll have to restart. 'ls' on the other hand seems not to care about the size of the test folder.
Hello Luther,
It often appears that you insist on asking applications to build AppleScript lists when not really needed.
If you want the Finder to count disk items, just ask the one who knows, that is the Finder:
set StartTime to current date
tell application "Finder" to set MyCount to count items of entire contents of folder "Library" of folder "System" of startup disk
display dialog "Elapsed time: " & ((current date) - StartTime) & return & "Count: " & MyCount
The above takes about 50 seconds here, for 108214 items.
Trying your way:
set StartTime to current date
tell application "Finder" to set MyList to items of entire contents of folder "Library" of folder "System" of startup disk
display dialog "Elapsed time: " & ((current date) - StartTime) & return & "Count: " & (count MyList)
the default timeout of two minutes is of course reached and the script halts; but the Finder desperately continues to try to build an AppleScript list of 108214 references, eating more and more resources... Obviously, I had to re-launch the Finder.
HTH,
Axel
_______________________________________________
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