4 ms·
It's awesome to see how more JS runtimes try to approach Wasm. This project reminds me to Static Hermes (the JS engine from Facebook to improve the speed of Rea
by syrusakbary 2y ago
It's awesome to see how more JS runtimes try to approach Wasm.
This project reminds me to Static Hermes (the JS engine from Facebook to improve the speed of React Native projects on iOS and Android).
I've spent a bit of time trying to review each, so hopefully this analysis will be useful for some readers. What are the main commonalities and differences between Static Hermes and Porffor?
* They both aim for JS test262 conformance [1]
* Porffor supports both Native and Wasm outputs while Static Hermes is mainly focused on Native outputs for now
* Porffor is self-hosted (Porffor is written in pure JS and can compile itself), while Static Hermes relies on LLVM
* Porffor currently doesn't support async/promise/await while Static Hermes does (with some limitations)
* Static Hermes is written in C++ while Porffor is mainly JS
* They both support TypeScript (although Static Hermes does it through transpiling the TS AST to Flow, while Porffor supports it natively)
* Static Hermes has a fallback interpreter (to support `eval` and other hard-to-compile JS scenarios), while Porffor only supports AOT compiling (although, as I commented in other thread here, it maybe be possible to support `eval` in Porffor as well)
In general, I'm excited to see if this project can gain some traction so we can speed-up Javascript engines one the Edge!
Context: I'm Syrus, from Wasmer [3]
[1] https://github.com/facebook/hermes/discussions/1137 https://github.com/facebook/hermes/discussions/1137
[2] https://github.com/tc39/test262 https://github.com/tc39/test262
[3] https://wasmer.io https://wasmer.io
- jonathanyc 2y agoJust wanted to say I really appreciated the high-quality comparison. How something compares to existing work is my #1 question whenever I read an announcement like this.
- deleted 2y ago[deleted]
- syrusakbary 2y agoThanks!
- wdb 2y agoYou make it sound bad to rely on LLVM.
- bangaladore 2y agoYeah... It is unclear to me how not using LLVM is a good thing. You'd inherit millions of man-hours of optimization work, code gen, and general thought process. Is there a technical reason why?
- fabrice_d 2y agoIn this case, being self contained will help implementing things like `eval()` and `Function()` since Porffor can self-host. That would be much harder with a LLVM based solution.
- deleted 2y ago[deleted]
- bobvarioa 2y agoContributor for Porffor here! I think this is a great comparison, but Porffor does technically support promises, albeit synchronously. It's a similar approach to Kiesel, https://kiesel.dev/ https://kiesel.dev/.
- frutiger 2y agoNot sure where you mean by synchronously but if you mean what I think you mean then that is not correct behaviour. This is important to ensure predicatibility. Eg. Promise.then(() => console.log(“a”)); console.log(“b”) must log [“b”, “a”] and not [“a”, “b”].
- canadahonk 2y agoThis type of test does work as expected. The "sync" means that it does not feature a full event loop (yet) so cannot easily support async I/O or some more "advanced" use cases.
- spankalee 2y agoThere's a WASI async functions proposal I think? Are you looking at supporting that so you don't have to bring your own event loop?
- cowsandmilk 2y agoJavaScript doesn’t make the guarantee you are claiming here
- fwip 2y agoWhat do you mean? Does JavaScript allow the `then` of a promise to execute before the contents of the promise?
- jitl 2y agoYes, it does. Promise continuations always run in the micro task queue per the standard. I guess if someone mutates the promise prototype it’s not guaranteed, but the spec does guarantee this order
- canadahonk 2y agoGood comparison and thanks! A few minor clarifications: - Porffor isn't fully self-hosted yet but should be possible hopefully! It does partially compile itself for builtins (eg Array.prototype.filter, Math.sin, atob, ...) though. - As of late, Porffor does now support basic async/promise/await! Not very well yet though.
- tmikov 2y agoFor the record, Static Hermes fully supports compiling JS to WASM. We get it basically for free, because it is an existing LLVM backend. See https://x.com/tmikov/status/1706138872412074204 https://x.com/tmikov/status/1706138872412074204 for example. Admittedly, it is not our focus, we are focusing mainly on React Native, where WASM doesn't make sense. The most important feature of Static Hermes is our type checker, which guarantees runtime soundness. Porffor is very interesting, I have been watching it for some time and I am rooting for it.
- syrusakbary 2y agoThanks for the correction Tzvetan! Keep up the great work in Static Hermes