• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why is it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is it


  • Subject: Re: Why is it
  • From: has <email@hidden>
  • Date: Tue, 29 Jan 2008 23:42:15 +0000


On 29 Jan 2008, at 22:03, Christopher Nebel wrote:

On Jan 29, 2008, at 1:00 PM, Michelle Steiner wrote:

This script takes four seconds to complete:

tell application "Finder"
	set foo to entire contents of (path to documents folder)
end tell

This script runs almost instantaneously:

tell application "Finder"
set foo to entire contents of (path to documents folder) as alias list
end tell

Essentially, because the first one returns a more complicated result. Finder spends about the same amount of time on both, but the first returns a list of object specifiers, all of which will be at least five levels deep, each of which has to be decoded separately, whereas the second one returns a list of aliases, which are atomic objects. If you're doing that in Script Editor, there's the additional expense of displaying the result -- it can slow way down when you throw a lot of styled text at it.


Nope, Finder definitely takes far, far longer to return a list of object specifiers than a list of aliases. Try it on a fatter folder, e.g. a typical ~/Library folder of 11,000 items:

#!/usr/bin/python

from appscript import *
from time import time

t = time()
app ('Finder ').home.folders['Library'].entire_contents.items(resulttype=k.alias)
print time() - t # 14.6 sec


t = time()
app('Finder').home.folders['Library'].entire_contents.items() # timeout error after 2 min
print time() - t


I can't tell you just how long it'd take to reply in the latter case as I force-restarted Finder after a few more minutes of watching it beachball.


has -- http://appscript.sourceforge.net http://rb-appscript.rubyforge.org

_______________________________________________
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
  • Follow-Ups:
    • Re: Why is it
      • From: Christopher Nebel <email@hidden>
References: 
 >Why is it (From: Michelle Steiner <email@hidden>)
 >Re: Why is it (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: Why is it
  • Next by Date: Re: OT: keep external drives mounted?
  • Previous by thread: Re: Why is it
  • Next by thread: Re: Why is it
  • Index(es):
    • Date
    • Thread