Are there factors that may prevent script jittering?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Qu0ll

    Are there factors that may prevent script jittering?

    [3rd attempt]

    In browsers which utilise a JIT JavaScript compiler, are there any factors
    that may prevent a script from being compiled before it is executed? I
    don't see any reason why this would be so but I would like to check that
    scripts that access Java classes & methods and/or scripts which are loaded
    dynamically using AJAX will both be valid candidates for jittering.

    --
    And loving it,

    -Qu0ll (Rare, not extinct)
    _______________ _______________ _______________ ____
    Qu0llSixFour@gm ail.com
    [Replace the "SixFour" with numbers to email me]
  • Lasse Reichstein Nielsen

    #2
    Re: Are there factors that may prevent script jittering?

    "Qu0ll" <Qu0llSixFour@g mail.comwrites:
    [3rd attempt]
    At?
    In browsers which utilise a JIT JavaScript compiler, are there any
    factors that may prevent a script from being compiled before it is
    executed?
    That's far too generalt a question to answer.

    In TraceMonkey (for Firefox), nothing guarantees it's compiled before
    it's executed the first time, but if it is executed often enough, a
    trace will be build and that trace is compiled.

    In V8 (currently in Google Chrome), all source code is compiled before
    execution, there is no interpreter.

    I don't know exactly what Squirrelfish Extreme (for Safari) does.
    I don't see any reason why this would be so but I would
    like to check that scripts that access Java classes & methods and/or
    scripts which are loaded dynamically using AJAX will both be valid
    candidates for jittering.
    I'd guess they are even. What might hurt you is any code that is not
    predictable, i.e., anything using "eval" (since it might change its
    surrounding scope, and cannot generally be compiled before the call)
    or inside a "with" statement (which makes the variable lookup
    unpredictable).
    Don't use either in a function that you want to be fast.
    This might affect you if you create function dynamically usig AJAX and
    eval.

    /L
    --
    Lasse Reichstein Nielsen
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Jorge

      #3
      Re: Are there factors that may prevent script jittering?

      On Oct 9, 6:53 am, Lasse Reichstein Nielsen <lrn.unr...@gma il.com>
      wrote:
      "Qu0ll" <Qu0llSixF...@g mail.comwrites:
      [3rd attempt]
      >
      At?
      >
      In browsers which utilise a JIT JavaScript compiler, are there any
      factors that may prevent a script from being compiled before it is
      executed?  
      >
      That's far too generalt a question to answer.
      >
      In TraceMonkey (for Firefox), nothing guarantees it's compiled before
      it's executed the first time, but if it is executed often enough, a
      trace will be build and that trace is compiled.
      >
      In V8 (currently in Google Chrome), all source code is compiled before
      execution, there is no interpreter.  
      >
      I don't know exactly what Squirrelfish Extreme (for Safari) does.
      >
      I don't see any reason why this would be so but I would
      like to check that scripts that access Java classes & methods and/or
      scripts which are loaded dynamically using AJAX will both be valid
      candidates for jittering.
      >
      I'd guess they are even. What might hurt you is any code that is not
      predictable, i.e., anything using "eval" (since it might change its
      surrounding scope, and cannot generally be compiled before the call)
      or inside a "with" statement (which makes the variable lookup
      unpredictable).
      Don't use either in a function that you want to be fast.
      This might affect you if you create function dynamically usig AJAX and
      eval.
      >
      A function, once eval()ed seems to run as fast as 'normal' ones: see:



      --
      Jorge.

      Comment

      • Qu0ll

        #4
        Re: Are there factors that may prevent script jittering?

        "Lasse Reichstein Nielsen" <lrn.unread@gma il.comwrote in message
        news:4p3mz7wo.f sf@gmail.com...
        >[3rd attempt]
        >
        At?
        At getting a response.
        In TraceMonkey (for Firefox), nothing guarantees it's compiled before
        it's executed the first time, but if it is executed often enough, a
        trace will be build and that trace is compiled.
        >
        In V8 (currently in Google Chrome), all source code is compiled before
        execution, there is no interpreter.
        >
        I don't know exactly what Squirrelfish Extreme (for Safari) does.
        OK, thanks for the info.
        I'd guess they are even. What might hurt you is any code that is not
        predictable, i.e., anything using "eval" (since it might change its
        surrounding scope, and cannot generally be compiled before the call)
        or inside a "with" statement (which makes the variable lookup
        unpredictable).
        Don't use either in a function that you want to be fast.
        This might affect you if you create function dynamically usig AJAX and
        eval.
        I am thinking specifically of functions invoked from within a Java applet
        using the JSObject method eval(). The functions exist in the surrounding
        HTML so a call would be something like:

        jsObject.eval(" calculateTotals ();");

        I am not sure if this is the same "eval" that you are referring to. Do you
        know if such JavaScript calls would be compiled or not?

        --
        And loving it,

        -Qu0ll (Rare, not extinct)
        _______________ _______________ _______________ ____
        Qu0llSixFour@gm ail.com
        [Replace the "SixFour" with numbers to email me]

        Comment

        Working...