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 22:59:39 -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/>
>
Shane,
This does not surprise me since something is really wrong with those calls.
For instance Math.cos gets 0 and pi correctly but everything else wrong..
Try the same tests with some of the calls that (apparently are working)
for instance Math.max() or Math.min().
As for the results, Smile is one of the best overall tools for Math computation.
But, I have another problem with JSA, namely “me" and “this" are not the something:
In AS
me's properties
—
(*
tell application "Script Editor"
get properties
end tell
Result:
{selection:insertion point after character 15 of text of document "Untitled 3.scpt", frontmost:true, class:application, name:"Script Editor", version:"2.7”}
*)
However:
this.properties()
—>TypeError: undefined is not a function (evaluating 'this.properties()')
PS. After an experiment, I had a crash, the wtf crash that you got after running a run script js call 1000 times.
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