On May 28, 2008, at 08:02 AM, Jens Alfke wrote:

Importing messages from Mail via AppleScript may not be fast enough — my highly scientific estimate* is "a couple of messages" a second. Importing someone's entire mail archive would take a long time.


I just did a test and it's quite fast if you ask for all the messages at once:

tell application "Mail"
        repeat with box in mailboxes
                set n to count messages of box
                log "Importing " & n & " messages from “" & (name of box) & "”"
                set startTime to current date
                get the source of every message of box
                set elapsedTime to (current date) - startTime
                log "Total: " & elapsedTime
                if n is not 0 then
                        log "Average: " & elapsedTime / n
                end if
        end repeat
end tell

I'm seeing average times of one to two milliseconds per message (e.g., 7 seconds for a mailbox with 4,660 messages) on a 2.5GHz Quad G5.

Be sure not to run this with event result logging turned on in Script Editor, although even with event logging turned on that same mailbox only takes 30 seconds or just over 6 milliseconds per message.

--
Chris Page - AppleScripter

 The other, other AppleScript Chris

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to