compiled to JavaScript idea

Thomas Reilly treilly at adobe.com
Mon Nov 5 13:18:52 PST 2007


There's this hookey idea percolating that somehow we can use whatever
language we want and compile it to JavaScript and that will be great.
Hold that thought, now check this out:
 
http://community.netikatech.com/demos/
 
I don't care how tricked out your JavaScript VM is, or how awesome your
source language and compiler are, JavaScript today will never reach this
richness of UI.   Look how big and snappy the Flash data grid example
is.  (I love how slow the silverlight one is so slow to load, can anyone
say applets? sorry couldn't help it...)
 
My point is that to reach JVM/CLR speeds ES4 with its strong typing and
early binding are necessities.   Sure a VM can be smart and take simple
untyped code and get you most of the way there with type inference and
runtime profile based JIT'ing but with ES4 dumb (and smaller) VM's can
get great speed just by looking at the typing (ie Tamarin).   But that
really only applies to microbenchmarks doing math in a loop, Tamarin
does good here but that's not what most real applications do.   Most
real applications spend all their time looking up variables, pounding on
symbol tables and visiting memory like crazy.   I'm unaware of any
workable and implemented techniques to get early binding accomplished in
ES3 w/o breaking the language.  Tamarin resorts to no trickery and gets
variable lookups down to a couple instructions and one cache line load,
that's why Tamarin/Java/C# do well in big real world applications that
JavaScript will never be able to handle in its current incarnation.   I
guarantee all JavaScript implementations out there take hundreds of
instructions and at least half dozen cache line loads to look up a
variable today (not counting AS3/Tamarin), if your JavaScript VM can
beat that my hat's off to you (but I won't believe you unless you can
show me the code or explain it in full detail ;-)
 
My point is that while in theory you don't need ES4 for performance
reasons (as accurately espoused by Brendan) in practice ES4 will greatly
help performance and enable more powerful applications like people might
want to built with netikatech's library.   Their stuff is also cool b/c
under the covers I think they are employing a C# to abc (Tamarin's byte
code format) compiler.   Notice they didn't implement a C# to JavaScript
compiler and target DHTML?    Not realistic.  Sure there's other good
reasons for wanting static typing and classes but lets face it, they
help a lot in the speed department and speed is king and ES4 will blow
the doors off of ES3 in practice I bet (although I wouldn't be surprised
if certain unmotivated browser vendors may run ES4 more slowly).  
 
Salient point:  we should pimp the performance potential of ES4 more and
label the anti-ES4 crowd as performance-haters which I don't think is
far from the truth.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20071105/3d08e5b1/attachment-0002.html 


More information about the Es4-discuss mailing list