IDE support?

Andreas Rossberg rossberg at google.com
Tue Sep 13 05:33:29 PDT 2011


On 13 September 2011 09:33, Brendan Eich <brendan at mozilla.com> wrote:
>
> You are simply way out of date on JS optimizing VMs, which (based on work done with Self and Smalltalk) all now use "hidden classes" aka shapes and polymorphic inline caching to optimize to exactly the pseudo-assembly you show, prefixed by a short (cheap if mispredicted) branch.
>
> What's more, SpiderMonkey bleeding edge does semi-static type inference, which can eliminate the guard branch.
>
> Please don't keep repeating out of date information about having to "seek through a dictionary". It simply isn't true.

True. On the other hand, all the cleverness in today's JS VMs neither
comes for free, nor can it ever reach the full performance of a typed
language.

* There are extra costs in space and time to doing the runtime analysis.
* Compile time is runtime, so there are severe limits to how smart you
can afford to get in a compiler.
* A big problem is predictability, it is a black art to get the best
performance out of contemporary JS VMs.
* The massive complexity that comes with implementing all this affects
stability.
* Wrt limits, even in the ideal case, you can only approximate the
performance of typed code -- e.g. for property access you have at
least two memory accesses (type and slot) plus a comparison and
branch, where a typed language would only do 1 memory access.
* Type inference might mitigate some more of these cases, but will be
limited to fairly local knowledge.
* Omnipresent mutability is another big performance problem in itself,
because most knowledge is never stable.

So despite all the cool technology we use these days, it is safe to
assume that we will never play in the performance league of typed
languages. Unless we introduce real types into JS, of course. :)

/Andreas


More information about the es-discuss mailing list