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.