Does chrome understand compiled javascript? -


instead of having v8 compile javascript on fly , then execute it, isn't possible compile javascript beforehand , embed machine code in page instead of embedding javascript in page?

the way understand it, v8 javascript engine compiles machine code anyway why not beforehand?

according w3c html5 scripting specification, there's no standards-based reason why browser couldn't support machine code special type attributes (as chrome dart language):

the following lists mime type strings user agents must recognize, , languages refer:

"application/ecmascript" "application/javascript" ... 

user agents may support other mime types other languages...

currently, no browser has implemented such feature.

i suspect primary shortcoming of such approach each chip architecture require machine-code version of script compiled specifically. means in order support 3 architectures, page need include compiled script 3 times. (and should included fourth time, plain javascript, fallback architectures didn't include, or browsers can't/don't support compiled code.) bloat size of page data useless. increase in load time seem offset or outweigh whatever time save on compilation.

an architecture-independent compromise solution bytecode seems pretty poor: still need include script twice (once bytecode, once scripts don't support it) , need kind of run-time processing on bytecode turn machine code.

the multiple-includes-with-fallback problem why other scripting languages have not made web environment: need coordinated cross-vendor support useful. google trying dart, remain seen degree of success see.

note chrome cache compiled versions of scripts script needs compiled once , compiled code cached reuse when user re-visits page.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -