JS/V8 is particularly impressive. I wonder how far we are from the theoretical performance limit on the software side?
I would guess we will eventually see deprecations of warts to improve engine performance further. Or integrated type system etc.
JS/V8 is particularly impressive. I wonder how far we are from the theoretical performance limit on the software side?
I would guess we will eventually see deprecations of warts to improve engine performance further. Or integrated type system etc.
But maybe there are technical reasons why it's not feasible
The thing Dart "fixed" in terms of performance is it forced consistent typing. It removed the ability to add/remove/change fields/methods on an object at runtime. The Achilles' heel of javascript (at least, when I got hype on dart years ago) is how stupidly easy it is to change the memory shape of any object. That means the VM can't generally lay out memory for an object in a compact form. Further, the VM has to do a bunch of checks before it can go down the optimized path (in case assumptions are invalidated).
For a consistent type system, the only check needed is "is this object shaped like I think it should be?" and then you go from there.
I think the most disappointing part of Dart is that all that effort was spent creating a new language when what the browser needed (and still needs) is a new bytecode. I'd love to see WASM reach the point of a universal bytecode but fear that it painted itself into a corner by first targeting memory managed languages.
There are a lot of caveats here. You could potentially claim "minimal gains in peak performance if you can apply adaptive JIT compilation techniques", but even that is stretching it somewhat.
Adaptive JITing comes at a price in terms of warmup, memory usage and implementation complexity. Fixed object shapes help somewhat to reduce the amount of checks needed but they don't take you all the way there. Optimising numerics remains challenging (e.g. think about optimising the case where a field always contains a `double` floating-point value or a field that always contains a 64-bit integer value). Knowing the shape of the container does not yield any information about the shape of elements which implies that some checks have to stay behind in the loops. Yes, monomorphic checks are usually simple (compare+branch) but polymorphic are not. And so on and so forth.
Yes, Dart 1 is easier to compile into efficient code compared to JavaScript. Dart 2 is even easier though - because it is more statically typed.
> but fear that it painted itself into a corner by first targeting memory managed languages.
FWIW WASM GC is coming - and it looks great.
I've not been tuned in. Is there some good forward progress there? It along with threads felt stalled out. I'd love to see GC adopted as that would, IMO, turn WASM into something close to a universal bytecode. It would significantly expand the number of languages that could reasonably target WASM.
Time to work on bringing back java applets ;)