Are there factors that may prevent script jittering?

Q

Qu0ll

[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)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
L

Lasse Reichstein Nielsen

Qu0ll said:
[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
 
J

Jorge

Qu0ll said:
[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:

http://jorgechamorro.com/cljs/019/
 
Q

Qu0ll


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)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top