• 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: degrading script performance in Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: degrading script performance in Mail


  • Subject: Re: degrading script performance in Mail
  • From: Matt Neuburg <email@hidden>
  • Date: Sat, 27 Aug 2005 12:16:15 -0700

On Sat, 27 Aug 2005 13:27:41 -0400, deivy petrescu <email@hidden>
said:
>
>On Aug 27, 2005, at 13:06, deivy petrescu wrote:
>>
>> Patrick, I've run many times the following script (in Smile, mind you)
>>
>> <script>
>> chrono
>> tell application "Mail"
>>     set l to name of every account
>>     set j to item 1 of l as string
>>     tell account j
>>         set k to read status of every message of mailbox 1
>>     end tell
>> end tell
>>
>> return {chrono, count of k}
>>   --  {0.430169999949, 1124}
>> </script>
>>
>> So it takes 0.43 seconds to get the read status of 1124 messages.
>> consistent over many runs!
>>
>
>
>However (still in Smile):
><script>
>chrono
>tell application "Mail"
>     set l to name of every account --(mailbox "Inbox")
>     set j to item 1 of l as string
>     --return j
>
>     tell account j
>         set k to read status of messages 1 thru 50 of mailbox 1
>     end tell
>
>end tell
>return {chrono, count of k}
>   --  {5.872329999984, 50}
></script>
>
>Same behavior in SE.
>It means you're better off if you get the whole set and then filter
>it than filtering it in Mail.

Better off than what? I tried this:

tell application "Mail"
    tell account 1
        set k to read status of messages 1 thru 300 of mailbox "Junk"
    end tell
end tell
-- 8 seconds
tell application "Mail"
    tell account 1
        tell mailbox "Junk"
            set L to {}
            repeat with i from 1 to 300
                set end of my L to read status of message i
            end repeat
        end tell
    end tell
end tell
-- 11 seconds

The first one is slow but it's still faster than the second one. And all
those Apple events - ugh! m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>



 _______________________________________________
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: degrading script performance in Mail
      • From: deivy petrescu <email@hidden>
  • Prev by Date: Re: Clipboard and Entourage
  • Next by Date: Re: degrading script performance in Mail
  • Previous by thread: Re: degrading script performance in Mail
  • Next by thread: Re: degrading script performance in Mail
  • Index(es):
    • Date
    • Thread