Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

    Determining Javascript Engine

    With Spidermonkey --> ActionMonkey/TraceMonkey, JSCore --> Squirrelfish, IE's... improved engine (still fundamentally the same?), and whatever Opera is using (it's hard to find anything specific about it), I was wondering if anybody knows of a nice way of detecting what engine (and what version) is being used. The user-agent generally gives build ids and the verion of whatever rendering engine, but nothing (directly) about the js engine. I could always make a guess at what JS engine is being used from the user-agent, but that is less than ideal.

    Any ideas?

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    You probably need to call a number of functions which are vendor specific in order to establish browser type. for example document.all is not supported by all browsers

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    ess: And document.all has nothing at all to do with the scripting engine.

    jkd:
    Mozilla: I don't think Gecko has anything that tells you whether the engine used in that build is ActionMonkey, SpiderMonkey or TraceMonkey. In fact, TraceMonkey with the nanoJIT turned off is in every way and form SpiderMonkey, and that's adjustable by a pref in about:config in the TraceMonkey builds. However, we know that TraceMonkey is going to be the default enabled engine for Ff3.1 and that ActionMonkey may or may not end up being the engine for Mozilla2.0/Gecko2.0/Ff4 depending on whether they get its performance on code that is not type annoted up to the level of TraceMonkey. Though since at the moment all JavaScript on the web lacks type annotations, changing to ActionMonkey seems a lesser and lesser option as ECMA TG39 drops more and more of the features that make ActionScript fast.

    Opera: It's easy for the moment: Versions < 9.50 use linear_b, versions >= 9.50 use futhark. I bet they have getting yet another engine into version 10 or 10.5 as a high priority item to meet the newly arisen competitive pressure from V8, SquirrelFish and TraceMonkey, so I would not assume futhark is staying for long unless they can gradually improve it along the way SpiderMonkey-->TraceMonkey did.
    It must be a bit discouraging for the Opera devs to see, futhark is a brand new engine, when it was publicly beta released it swept past every other browser scripting engine solidly into the first place when it comes to speed. Just a few months later, both JavaScriptCore and SpiderMonkey have suddenly been optimised to double their performance and are faster, and there's all of a sudden three new engines that compete for the performance crown ahead of those two.

    Microsoft: The data on script engine version is available in the ScriptEngine object. Be aware however that there are multiple different versions of both JScript 5.6 and JScript5.7. In other words, JScript 5.6 can be installed on ie<6, and for JScript5.7 there are actually two entirely separate versions of JScript with that version number, one for ie7 and one for ie<7, and the one bundled with ie7 contains many more improvements than the one for ie<7. JScript5.8 seems confined to ie8 so far, though.

    WebKit: No way to differentiate between JavaScriptCore and SquirrelFish that I know of, since the latter is just an incremental rewrite of the former into a bytecoded engine.

    Google: Well, if it's Chrome it's using V8.





    In short: You need to use browser version sniffing to know, for those where it's at all possible to know. And Microsoft gives you the information, but is treacherous in that the same version doesn't mean the same thing in different browsers. And the Pink Invisible Unicorn be with you if you ever encounter fringe browsers!
    Last edited by liorean; 09-03-2008 at 11:52 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • The Following 2 Users Say Thank You to liorean For This Useful Post:

    jkd (09-04-2008), oesxyl (09-04-2008)

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    As always, good information. Thanks!

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    jkd: As it seems, Mozilla killed the ActionMonkey project in their meeting yesterday. (I noticed because I was CCed on some bugs that Jason Orendorff mass-marked as WONTFIX.) ActionMonkey simply couldn't match the SpiderMonkey performance on code lacking type annotations, and that even before they added the nanoJIT from tamarin-tracing to SpiderMonkey in order to produce TraceMonkey. See <uri:https://wiki.mozilla.org/JavaScript:ActionMonkey> for the full rationale behind the decision.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •