By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,985 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Are there factors that may prevent script jittering?

P: n/a
[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)
_________________________________________________
Qu**********@gmail.com
[Replace the "SixFour" with numbers to email me]
Oct 9 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Qu0ll" <Qu**********@gmail.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/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Oct 9 '08 #2

P: n/a
On Oct 9, 6:53*am, Lasse Reichstein Nielsen <lrn.unr...@gmail.com>
wrote:
"Qu0ll" <Qu0llSixF...@gmail.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:

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

--
Jorge.
Oct 9 '08 #3

P: n/a
"Lasse Reichstein Nielsen" <lr********@gmail.comwrote in message
news:4p**********@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)
_________________________________________________
Qu**********@gmail.com
[Replace the "SixFour" with numbers to email me]

Oct 9 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.