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: Shane Stanley <email@hidden>
- Date: Thu, 18 Dec 2014 22:09:49 +1100
On 18 Dec 2014, at 8:09 pm, Emmanuel LEVY <email@hidden> wrote:
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.
You need a faster Mac:
use scripting additions use framework "Foundation" use framework "WebKit" set theDate to current application's NSDate's |date|() set theWebView to current application's WebView's alloc()'s init() set x to (theWebView's stringByEvaluatingJavaScriptFromString:"var i, x=0 ; for ( i = 0 ; i < 1000000 ; i++ ) x += Math.tan ( 1 ) ; x") as text current application's NSDate's |date|()'s timeIntervalSinceDate:theDate
~0.06 seconds. (And before anyone tries this at home, you need to run it in the foreground.)
|
_______________________________________________
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