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: Deivy Petrescu <email@hidden>
- Date: Wed, 17 Dec 2014 23:21:11 -0500
> On Dec 17, 2014, at 21:48 , Shane Stanley <email@hidden> wrote:
>
> On 18 Dec 2014, at 1:17 pm, Deivy Petrescu <email@hidden> wrote:
>>
>> set k to run script "Math.tan((Math.PI)/3)" in “Javascript”
>
> Out of interest, I decided to see how slow it is to run scripts this way. I put your code into Script Geek and told it to time 100 loops. The average was around 0.014 seconds, so the answer is "very slow". But if I run it a few times, it crashes Script Geek rather spectacularly.
>
> The crash report shows 1994(!) threads running, all but 7 of them in JavaScriptCore. The crashing thread at least hints at a sense of humor:
>
> Thread 7 Crashed:
> 0 com.apple.JavaScriptCore 0x00007fff921c8f6e WTFCrash + 62
> 1 com.apple.JavaScriptCore 0x00007fff91ffcd86 JSC::MachineThreads::makeUsableFromMultipleThreads() + 38
> 2 com.apple.JavaScriptCore 0x00007fff91ffce09 JSGlobalContextCreateInGroup + 89
> 3 com.apple.JavaScriptCore 0x00007fff9237f8fa -[JSContext initWithVirtualMachine:] + 122
> 4 com.apple.JavaScriptAppleEvents 0x000000011113044e __JSAEContextCreate_block_invoke78 + 47
>
>
> By comparison, this:
>
> use framework "ASObjCExtras"
> set k to current application's SMSFord's tanValueOf:(pi / 3)
>
> took 0.006 seconds -- in total, for all 100 runs. Using Satimage's "tan" command was twice as fast again.
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>
>
But running this script
c =new Date
for (i=0; i <100000; i++){
g=Math.tan(Math.PI/3)
}
j=new Date
j.getTime()-c.getTime()
——>5
That is 5ms for 100000 runs.
Not bad!
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