Re: JSA -- now I believe this is a bug (JSA or AS)
Re: JSA -- now I believe this is a bug (JSA or AS)
- Subject: Re: JSA -- now I believe this is a bug (JSA or AS)
- From: Emmanuel LEVY <email@hidden>
- Date: Thu, 18 Dec 2014 10:09:42 +0100
[ Sorry I made a typo, please discard my previous mail ]
FWIW, you can use Javascript from Smile, I mean if you're in a hurry :-)
Indeed, JS in incredibly fast compared to AS, look:
----
callJavaScript ww script "var i, x=0 ; for ( i = 0 ; i < 1000000 ; i++ ) x += Math.tan ( 1 ) ; x" [1]
----
runs in 0.08 second! Or, 0.08 microsecond per iteration. (The final "x" is to make sure some optimization process is not skipping the whole computation, considering no-one needs the result!) This is on a 2Ghz clocked machine.
This is 9 times faster than 1,000,000 simple additions in AS:
----
set x to 0
repeat 1000000 times
set x to x + 1
end repeat
----
And 40 times faster than the same program in AS - with an OSAX call:
----
set x to 0
repeat 1000000 times
set x to x + (tan (1))
end repeat
----
Emmanuel
[1] First you have to run, once for all: set ww to make new web window, in order to provide a context to JS.
On Dec 18, 2014, at 6:30 AM, Deivy Petrescu wrote:
>
>> On Dec 18, 2014, at 24:20 , Shane Stanley <email@hidden> wrote:
>>
>> On 18 Dec 2014, at 3:58 pm, Deivy Petrescu <email@hidden> wrote:
>>>
>>> So was mine! That is running run script in JS.
>>
>> That's not the same thing as calling "run script" from AppleScript.
>
> Yes, it is, in JSA is “runScript”.
>
> It would be simpler to run something like
>
> run script "Math.cos(x)” as “JS”
>
>
>>
>> --
>> Shane Stanley <email@hidden>
>
> Deivy Petrescu
> email@hidden
>
>
> _______________________________________________
> 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
_______________________________________________
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
_______________________________________________
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