4 ms·
RPython-Based VMs: Fast Enough in Fast Enough Time
- ciupicri 6y ago> February 8 2012, last updated February 7 2013
- SLWW 6y agoAccurate.
- gandalfgeek 6y agoGraal and Truffle also let one do something like this: write an interpreter for a language and get an optimizing JIT compiler for “free”.
- augusto-moura 6y agoToday a big contender for a VM to rule them all is WebAssembly, even though the primary motivation at the start was a web language, the design of the intermediate language (.wasm) is explendid, it hits the sweet spot of a LISP language with static types and low level coding
- pjmlp 6y agoIf it ever moves beyond the MVP and the tooling moves beyond installing a klundge of clang, Python, nodejs and Java tools and hope for the best when juggling them.
- chrisseaton 6y agoDo you think WebAssembly is well-suited to dynamic languages with a lot of dynamic dispatch and dynamically generated code?
- kevingadd 6y agoIt is an extremely poor fit for dynamic languages. Maybe in a few years, once it has some better tooling for things like JIT. At present you might be better off compiling to JS - dynamic dispatch in WASM has some fixed overhead and dynamically generating code has severe limitations, while in JS there's no special overhead for dynamic dispatch and you can freely create as much code as you want at runtime and still benefit from JIT optimizations including inlining.
- augusto-moura 6y agoOf couse! In the same way of Jython wasm can still be JITimed and get close to native performance
- chrisseaton 6y ago> can still be JITimed and get close to native performance Has anyone achieved this yet? I haven't seen any results myself but I haven't been looking carefully. Also wouldn't you have to build that JIT yourself and all the primitives you need to implement a dynamic language like the caches and deoptimisation? Seems like it's not really providing the needed tools and you'd have to build a lot of basics on top of it.
- augusto-moura 6y agoWasm is just the spec, browsers and wasm vm implementations that will implement the JIT evaluator, and yes JIT is already being implemented in some vendors, of course nothing final yet. Wasm is not mature like the other big VMs yet, but it is still a big contender
- chrisseaton 6y ago> browsers and wasm vm implementations that will implement the JIT evaluator I'm not sure this is the case - I think it's down to the Wasm application to implement any JIT - so it's not doing much of the work of a traditional VM - you have to build all that yourself from the ground up. > and yes JIT is already being implemented in some vendors I've not seen any examples - can you reference once? You said 'of course' it's suitable for dynamic languages... but there's no evidence of this anywhere yet and many other people with experience disagree.
- kaba0 6y agoThat’s JIT of wasm down to machine code. That’s different from JIT of dynamic language down to wasm.
- rgrmrts 6y agowasmtime[0] is a WebAssembly standalone runtime that does JIT. It’s quite performant anecdotally and I think some benchmarks might be available. [0] https://github.com/bytecodealliance/wasmtime https://github.com/bytecodealliance/wasmtime
- samth 6y agoIt is not yet, and while some people working on Wasm think they will eventually accomplish this, there's not that much evidence that it will happen.
- jxy 6y agoIf you want to look at the JIT overhead, for the benchmark stone and Richards, multiply the first number by ten and subtract the second number. And you can do it in your head, CPython is the fastest if you only going to launch the interpreter and run the program once. The sorting benchmark is more interesting. One could estimate where the breakeven point is, if considering the sorting scaling to be exactly n*log(n). Though the timings could be considerably different once everything fits in L2 or L1 cache.