• 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: deivy petrescu <email@hidden>
  • Date: Sat, 27 Aug 2005 15:42:49 -0400


On Aug 27, 2005, at 15:16, Matt Neuburg wrote:

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:

You are better off than filtering in Mail.
Granted, I was not clear and I should have posted the script I used to test!



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.

Bad again, because you are filtering it in Mail.

This is what I meant:

<script>
chrono
tell application "Mail"
    tell account 1
        tell mailbox "Junk"
        set k to read status of every message -- reading everything!
        end tell
    end tell
end tell
set k to items 1 thru 50 of k -- filtering outside Mail
return {chrono, count of k}
-- {0.317443999986, 50}

By the way, I used your script but I ran the same script I posted above. So I am checking the first 50 messages of 1124. But first I get the read status of all the messages.

I hope I was clearer now!


deivy _______________________________________________ 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
References: 
 >Re: degrading script performance in Mail (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: degrading script performance in Mail
  • Next by Date: Re: Adding event to iCal with timezone
  • Previous by thread: Re: degrading script performance in Mail
  • Next by thread: Re: degrading script performance in Mail
  • Index(es):
    • Date
    • Thread