• 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: Slowing Down
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slowing Down


  • Subject: Re: Slowing Down
  • From: Axel Luttgens <email@hidden>
  • Date: Thu, 27 Aug 2009 22:42:16 +0200

Le 27 août 09 à 21:17, Luther Fuller a écrit :

I have a script that contains something like this ...

	set folderList to (folders of outerFolder) as alias list
	repeat with aFolder in folderList
		set fileList to (files of aFolder) as alias list
		repeat with aFile in fileList
			-- do stuff
		end repeat
	end repeat

I have also included code to calculate the number of files processed per second.
Each time I run this, a batch of hundreds of files are processed.


Timing looks like this ...
	batch 1 ... 1.5 files/sec
	batch 2 ... 1.4 files/sec
	batch 3 ... 1.2 files/sec
	batch 4 ... 0.9 files/sec
	Restart
	batch 5 ... 1.8 files/sec

If I continue running batches without restarting, it gets really, really slow.
Anyone know what's happening, here?

By "restart", do you mean rebooting the whole box?
What happens when just re-launching the Finder?
Do you run the script in Script Editor? If yes, does quitting then re- starting Script Editor have some beneficial effect?


On the other hand, depending on the stuff to be done in "do stuff", perhaps could you try to avoid some costly lists; something along those lines:

  repeat with aFolder in folders of outerFolder
    repeat with aFile in files of aFolder
      -- do stuff with aFile or with aFile as alias
    end repeat
  end repeat

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: Slowing Down
      • From: Luther Fuller <email@hidden>
    • Re: Slowing Down
      • From: Luther Fuller <email@hidden>
    • Re: Slowing Down
      • From: Luther Fuller <email@hidden>
References: 
 >Slowing Down (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Slowing Down
  • Next by Date: Re: Slowing Down
  • Previous by thread: Re: Slowing Down
  • Next by thread: Re: Slowing Down
  • Index(es):
    • Date
    • Thread