I have created a folder with 6000 sub folders inside of it each numbered 1 to 6000.
I run the following script in Tiger and it takes 0 to 1 second to complete. In Leopard it takes 15-20 seconds on the same machine.
tell application “Finder”
set mydate to current date
set myStart to time of mydate
set theFolder to folder “ADSERVERSMB:PAUL_TEST_LEO:” as alias
open folder theFolder --<-- this takes forever on Leopard
set theWindow to container window of theFolder
set current view of theWindow to list view
set myend to (current date) - myStart
display dialog ((time of myend as string) & " seconds")
I have done alot of surfing and seen questions of slow finder in Leopard but there are not many answers. this is not a new install, spotlight is not indexing, my mac G5 is a dual boot tiger/leopard (two distinctly different boot drives). this is a simple script which demonstrates the poor performance of Leopard with large folders. double clicking the finder is not great either but it is much faster than this script. Is there anything that can be done to optimize applescript on Leopard?
Model: Dual 2 GHz PowerPC G5 4GB RAM
AppleScript: 2.0 on OS X 10.5.5
Browser: Firefox 22.214.171.124
Operating System: Mac OS X (10.5)
is the column size enabled in Leopard but not in Tiger?
It can take a lot of time to calculate all the sizes
No column size calculations, icon preview set to no ( In this case the 6000 sub folders inside my test folder are all empty.)
The length of time to execute is directly linked to the number of items in the folder.
I have had clients ask me that our application is slow on their new macs which happen to be 10.5.
I am beginning to worry/wonder as it does not seem obvious that there is a solution. This was just a simple example which might fare better with Python or some other language other than applescript. However we have lots of applescript in use.
The finder is not as fast but it does open the folder much faster than my test script.
in almost all cases it is not necessary in AppleScript to open any folder to process its contents
the script is attached to a button in our software to simply open the folder as if they double clicked on it. The users want to see the contents of where their current document is located. But even opening a single folder that is part of a larger list is slow in Leopard.
So we are not processing any of the items in the folder via script. We are simply viewing the contents. It saves the user from having to traverse through the finder and double click their folder.
That aside, the script is an example. Why does it take so much longer in Leopard? We may have to contact Apple and see. That is why i posted a simple script. Anyone should be able to duplicate this behaviour fairly easily.
Just for the record,
On y Machine it takes 2 seconds.
Model Name: iMac
Model Identifier: iMac5,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.16 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Memory: 2 GB
Bus Speed: 667 MHz
System Version: Mac OS X 10.5.5
Applescript Version 2.2
How are you connecting to the network?
it does not matter whether I use smb or afp the problem persists. this is not just my machine but clients
complaining from all over the country. this is not something unique to my mac.
there’s lots of discussions about the finder still being slow and no answers from Apple.
Over the network by afp: 7 seconds.
Do you have a Tiger box to compare with?
Are you GBit ethernet we are 100BaseT.
You may have better performance with your setup but if you try tiger, the script will probably be in your
case not even measurable.
Seven seconds does not seem like a lot but relatively speaking 7 times as long is a big difference.
Thanks for your time on this issue.