3 ms·
This is less an issue with "very small examples" and more an issue of people throwing the practices out when they build more complex software. Highly performan
by just2n 13y ago
This is less an issue with "very small examples" and more an issue of people throwing the practices out when they build more complex software.
Highly performant JS ends up looking a lot like C, and most of the off-the-shelf JS libraries that people use to build software are littered with '.call', '.apply', 'arguments', null/undefined/true/false usage, implicit type conversions, unnecessary closures, etc. All of these are cases that V8 doesn't optimize well, and because the libraries are built to be highly abstract and useful by using these, performance drops off precipitously. It's completely possible to write a large JS application that's competitive with Java in performance -- but nobody does it.
V8 hasn't even really begun optimizing these things, and they're going to be incredibly hard to optimize well. So perhaps a more apt question is: when JS VMs have as much time in the oven as the JVM has had, what will the performance look like?