I've been thinking about the future of Javascript and Javascript performance and scalability lately. Joel Spolsky mentions that the future is a programming language which compiles to Javascript (several projects already in progress, by the way).
My vision of the future is serving pre-compiled, cached Javascript directly to
clients. Firefox plans to use the Tamarin Javascript engine
to run Javascript inside the browser. Why not just send precompiled Tamarin
bytecode downstream. A web browser simply requests foo.js with an HTTP
Accept header something like Accept: application/tamarin,
text/javascript; q=0.8 The server compiles foo.js, caches the result for
future requests and sends the bytecode downstream. This reduces the download
size and speeds up client behavior. If a browser doesn't understand
pre-compiled Tamarin bytecode, it'll just get the straight Javascript like
before.
If this happens, it doesn't matter how one generates Javascript or bytecode, it'll be faster to download and run.
1 comments:
I read this article about using trace trees to locate and compile looped content within an interpreted language as the program is running, in essence compiling and optimizing the program in real time.
They also suspect Google's V8 to be using some variation of trace trees to get similar results. In both cases the JavaScript preformed many times faster.
heres the link
http://broadcast.oreilly.com/2008/09/turbo-charging-javascript---tr.html
Also I found this simple benchmark program someone wrote in javascript.
The source of these two pages is very similar the only difference is that the faster one has the line src="js/excanvas.compiled.js"
this one is faster
http://www.themaninblue.com/experiment/AnimationBenchmark/canvas/
this one is slow
http://www.themaninblue.com/experiment/AnimationBenchmark/html/
Post a Comment