• 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: Slow vs faster
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slow vs faster


  • Subject: Re: Slow vs faster
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 8 Jan 2011 08:28:11 +0100

Le 6 janv. 2011 à 20:55, Luther Fuller a écrit :

> I have a very old script which I use often. Yesterday, I was watching it grind thru a long list of folders and wondering why it was so irritatingly slow in Snow Leopard. The script, with all the irrelevant stuff removed, looks like this ...
>
> [...]
>
> For no good reason, I modified the code to this ...
>
> [...]
>
> Now it runs noticeably faster. (but still not blazing fast)
> But, why?

Hello Luther,

Do you mean that:

	on walk1(A)
		tell application "Finder"
			repeat with F in (sort folders of A by name)
				my walk1(F)
			end repeat
		end tell
	end walk1

is intrisically much slower than:

	on walk2(A)
		tell application "Finder"
			set L to (sort folders of A by name)
			repeat with I from 1 to count of L
				set F to item I of L as alias
				my walk2(F)
			end repeat
		end tell
	end walk2

on your machine?

I found this a bit surprising, but who knows?
So, I tried. ;-)
But couldn't notice any obvious difference here.
(in fact, walk2 even seems to be a bit slower; I guess this is because one is asking the Finder to convert a Finder reference into an alias which has then to be re-interpreted by the Finder)

Now, running both handlers several times shows increasing execution times.
This is even worse when adding a "select F" statement (with statements avoiding to have too many open windows).
But this must be a Finder thing: re-launch it, and initial execution times are back to reasonable values.

Anyway, I guess my walk1/walk2 comparison didn't catch your point.
Could you provide a better example?

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

  • Follow-Ups:
    • Re: Slow vs faster
      • From: Axel Luttgens <email@hidden>
References: 
 >Slow vs faster (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: New to AppleScript,please help.
  • Next by Date: Re: Slow vs faster
  • Previous by thread: Re: Slow vs faster
  • Next by thread: Re: Slow vs faster
  • Index(es):
    • Date
    • Thread