• 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: Performance assistance please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance assistance please


  • Subject: Re: Performance assistance please
  • From: "Andrew T. Lynch" <email@hidden>
  • Date: Tue, 1 Feb 2005 13:43:31 -0800

Thanks for your response Jake. I originally started out this way, but it seemed that it cost time to switch back and forth from "tell iphoto" to "tell finder". Is this the case? That version was before I found out the "a reference to" method for list access.

Adding photos to albums does not change the total count of photos. I'll try your idea.

Is there a faster way to create a list? Is is faster to push onto the front of a list? Can I keep a pointer to the end?

Thanks again,
-Drew

On Feb 1, 2005, at 1:39 PM, Jake Pietrykowski wrote:

Hi Drew,

Your performance decreases as the size of your list 'L' grows too large as
the script progresses.


Perhaps you could do something that as the totalsize reaches the size of the
DVD, a new list is created.:


--Didn't test this, but maybe useful as a conceptual aid

set L to {}
set photoCounter to 0
tell application "iPhoto" to set theCount to the count of every photo
repeat with i from 1 to theCount
set photoCounter to photoCounter + 1
 tell application "iPhoto"
  set thePhoto to photo i
  set thePath to the image path of thePhoto
 end tell
 tell application "Finder"
  set theSize to the size of ((thePath as POSIX file) as alias)
  set the end of L to {iindex:i, ipath:thePath, isize:theSize}
  set totalsize to totalsize + theSize
  if totalsize > 4.0E+9 then
    --exit repeat and/or create album,then start new list
  end if
 end tell
end repeat

Use the photoCounter to keep track of which photo you're on.

WAIT...as I'm writing this (I'm not an iPhoto user) but if in mid-stride a
new album is created and add photos to it, does that muck up theCount of
total photos? I'd guess it does, so then this is null and void then. Maybe
perhaps some insight on how you can alter your script to avoid the
performance decrease as the size of your list 'L' increases in size. Use
multiple lists. (40GB / 4.4GB = only about 10 lists ;-)


Best Regards,
Jake


On 2/1/05 10:31 AM, "Andrew T. Lynch" <email@hidden> wrote:

Hi All,
I'm a long time software developer and mac user, but new to
applescript. I wrote the following to create albums in iphoto which
could be easily burned to dvd. I have over 22,000 photos in my
library, totalling about 40Gb. It works fine when I test it on a
smaller library, but on a larger one, it just bogs down. I turned in
event tracking, and you can see the first thousand or so images zip by,
but by about 5000 or so they take a second or two each, and this is
just the first phase where collecting the image paths. BTW, this is
running on my new 2.5Ghz DP with 1.5G of ram. (happy birthday to me!).
Thanks in advance for any assistance.


Cheers,
    Drew


set L to {} tell application "iPhoto" set theCount to the count of every photo repeat with i from 1 to theCount set thePhoto to photo i set thePath to the image path of thePhoto set the end of L to {iindex:i, ipath:thePath, isize:0} end repeat end tell tell application "Finder" repeat with i in (a reference to L) set thePath to the ipath of i set the isize of i to the size of ((thePath as POSIX file) as alias) end repeat end tell tell application "iPhoto" set L2 to {} set dvdcount to 1 set totalsize to 0 set albumname to "dvd_" & dvdcount new album name albumname set theAlbum to album albumname repeat with i in (a reference to L) set totalsize to totalsize + (isize of i) set the end of L2 to the iindex of i if totalsize > 4.0E+9 then repeat with j in (a reference to L2) add photo j to theAlbum end repeat set L2 to {} set totalsize to 0 set dvdcount to dvdcount + 1 set albumname to "dvd_" & dvdcount new album name albumname set theAlbum to album albumname end if end repeat repeat with j in (a reference to L2) add photo j to theAlbum end repeat end tell


- Andrew T. Lynch - Chief Zymurgist - Verisity Design Inc. - (650)934-6875

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden



- Andrew T. Lynch
- Chief Zymurgist
- Verisity Design Inc.
- (650)934-6875

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Performance assistance please
      • From: Courtney Schwartz <email@hidden>
References: 
 >Re: Performance assistance please (From: Jake Pietrykowski <email@hidden>)

  • Prev by Date: Re: Performance assistance please
  • Next by Date: Re: Labelling identically-named files in two Finder folders
  • Previous by thread: Re: Performance assistance please
  • Next by thread: Re: Performance assistance please
  • Index(es):
    • Date
    • Thread