• 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: [applescript] Slow code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [applescript] Slow code


  • Subject: Re: [applescript] Slow code
  • From: Brian Christmas <email@hidden>
  • Date: Wed, 13 Sep 2017 01:16:34 +1000

G’day Karsten

Thank you very, very much.

I’ve made some further alterations, and in Script Debugger it takes a
consistant 3.55 seconds now.

However, in my App, it now takes less than 2 seconds, whereas before the code I
had was taking double the time it took in Script Debugger. I was waiting about
30 seconds.

Great thinking, my appreciation!

Regards

Santa


use AppleScript version "2.4"
use framework "Foundation"
use framework "AppKit"
use scripting additions
set l to ""
set f1 to 19480822
set f2 to 19471206
random number 1.0E+11 to 9.99999999999E+11 with seed my fixIt()
my doit()
on doit()
        set collector to {}
        set f1 to 19480822
        set f2 to 19471206
        random number 1.0E+11 to 9.99999999999E+11 with seed my fixIt()

        repeat with x from 1 to 10000
                set r1 to random number from 10 to 100
                set r2 to random number from 10 to 100
                set f1 to f1 + r1
                set f2 to f2 + r2

                set r3 to random number from 100000 to 999999
                set r4 to random number from 100000 to 999999

                set l to (f1 as text) & "-" & f2 & "-" & (r3 as string) & "-" &
(r4 as string) & return
                set end of collector to l
        end repeat
        set resultstring to collector as string
        return resultstring
end doit


> On 12 Sep 2017, at 9:57 pm, Karsten Wolf via Groups.Io
> <karstenwo=email@hidden> wrote:
>
> Replacing all "as text" with "as string" shaves another 0.5s
>
> -karsten
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Groups.io Links:
>
> You receive all messages sent to this group.
>
> View/Reply Online (#47): https://apple-dev.groups.io/g/applescript/message/47
> View All Messages In Topic (6):
> https://apple-dev.groups.io/g/applescript/topic/6007000
> Mute This Topic: https://groups.io/mt/6007000/360169
> New Topic: https://apple-dev.groups.io/g/applescript/post
>
> Change Your Subscription:
> https://apple-dev.groups.io/g/applescript/editsub/360169
> Group Home: https://apple-dev.groups.io/g/applescript
> Contact Group Owner: email@hidden
> Terms of Service: https://groups.io/static/tos
> Unsubscribe:
> https://apple-dev.groups.io/g/applescript/leave/695760/955856845/xyzzy
> -=-=-=-=-=-=-=-=-=-=-=-
>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: [applescript] Slow code
      • From: Deivy Petrescu <email@hidden>
References: 
 >Slow code (From: Brian Christmas <email@hidden>)
 >Re: Slow code (From: Takaaki Naganoya <email@hidden>)

  • Prev by Date: Re: Saving an encrypted PDF in Word 2016
  • Next by Date: Re: [applescript] Slow code
  • Previous by thread: Re: [applescript] Slow code
  • Next by thread: Re: [applescript] Slow code
  • Index(es):
    • Date
    • Thread