Re: [applescript] Slow code
Re: [applescript] Slow code
- Subject: Re: [applescript] Slow code
- From: Brian Christmas <email@hidden>
- Date: Tue, 12 Sep 2017 18:16:10 +1000
G’day all
This effort, after pouring over Shanes Ebook, and lots of googling, only
stripped 2.4 seconds off the proccessing time, down to 14.3 seconds
Can anyone suggest further or better improvements, please.
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()
repeat with x from 1 to 10000
set y to x as text
set f1 to f1 + (random number from 10 to 100)
set f2 to f2 + (random number from 10 to 100)
set m to random number from 1.00000000001E+11 to 9.99999999999E+11 as
text
set temp to number_to_string(m)
set l to l & f1 & "-" & f2 & "-" & characters 1 through 6 of temp & "-"
& characters 7 through -1 of temp & return as text
end repeat
on number_to_string(this_number)
tell current application's class "NSNumber" to set theNSNumber to
this_number
tell current application's class "NSNumberFormatter" to set
theResultNSString to localizedStringFromNumber_numberStyle_(theNSNumber,
current application's NSNumberFormatterNoStyle)
return theResultNSString as string
end number_to_string
on fixIt()
set c1 to "743196734015346789"
set c2 to "025694701243831634"
set c3 to "690116383350418453"
set x to characters 9 through 14 of c1 & characters 2 through 8 of c2 &
characters 11 through 15 of c3 as text as integer
return x
end fixIt
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
References: | |
| >Slow code (From: Brian Christmas <email@hidden>) |
| >Re: Slow code (From: Takaaki Naganoya <email@hidden>) |