4 ms·
One cannot have writeable executable memory on iOS (apple can, we cannot). Thus one cannot make a JIT compiler for js and thus pages are slow. Game engines su
by sharpneli 7y ago
One cannot have writeable executable memory on iOS (apple can, we cannot).
Thus one cannot make a JIT compiler for js and thus pages are slow.
Game engines such as Unity use il2cpp to go from the C# stuff into C++ that can be statically compiled as running the C# as bytecode would be too slow without a jitter.
- radarsat1 7y agoAh, so it is all about the javascript engine? Ok I can see how that might put up some major technical barriers, but still it should be technically feasible to have the firefox rendering engine make use of the iOS javascript engine, no? Maybe it's not worth the effort of course. I am just trying to get a feel for what the barriers are.
- sharpneli 7y agoNot via public apis. So cannot be placed into app store.
- vbezhenar 7y agoI think that iOS JS engine is tied to WebView and it would be hard to re-use it with other rendering engine.
- saagarjha 7y agoJavaScriptCore can be used can be used independently from the rest of WebKit, but I’d expect it to be slow.
- KonkeyDong69 7y agoIn addition to what the other replies said, feel free to eyeball the code required to embed SpiderMonkey in Firefox at https://github.com/mozilla/gecko-dev/tree/master/dom/bindings https://github.com/mozilla/gecko-dev/tree/master/dom/binding.... It's rather large and complex.
- padenot 7y agoThis is not at all the code to embed SpiderMonkey in Firefox, those are the bindings from DOM APIs to the implementation of those APIs in Firefox. Above that, calling into this layer, is another layer that transforms JS calls into C++ calls (roughly). The interface between SpiderMonkey and the rest of Firefox is here: https://searchfox.org/mozilla-central/source/js/src/jsapi.h https://searchfox.org/mozilla-central/source/js/src/jsapi.h.
- zzzcpan 7y ago> One cannot have writeable executable memory on iOS (apple can, we cannot). > Thus one cannot make a JIT compiler for js and thus pages are slow. Lack of JIT doesn't slow down pages much. I believe the difference is so small that it might even be possible to be faster without JIT for most pages, especially on low power devices, it's only computation heavy pages that are going to suffer and even then it's not like you can't optimize common patterns statically ahead of time. It doesn't mean that it's a good idea to invest into it, you are still under Apple's mercy and they clearly don't want competing browser engines.
- sharpneli 7y agoIf I have understood correctly (I’m a C++ graphics programmer. So don’t know too much about what’s flashy in the web world) V8 only jits. As in it can only produce machine code and there is not even an option to run it as an interpreter.
- saagarjha 7y agoV8 has a high performance, JIT-less interpreter that disables TurboFan and relies exclusively on Ignition: https://v8.dev/blog/jitless https://v8.dev/blog/jitless
- chrisseaton 7y ago> Lack of JIT doesn't slow down pages much. So why do you think so many major companies invest such a huge amount of money in JS JITs? Google, Apple, Microsoft, Oracle, Mozilla all maintain JS JITs and spend what I guess is hundreds of millions of dollars a year on it.
- notacoward 7y agoA budget of $100M, with 50% devoted to salary and a median salary of $250K, would be 200 developers. I seriously doubt any of the companies you name are devoting even a quarter of that to JS JIT development. Yes, they each make significant investments, but let's not weaken the argument by indulging a penchant for hyperbole.
- saagarjha 7y ago> One cannot have writeable executable memory on iOS (apple can, we cannot). Nitpick: you can but you cannot ship it via the App Store.
- shkkmo 7y agoApple as does not allow side-loading, so wouldn't a jailbreak be required?
- least 7y agoJailbreak, enterprise certificate, testflight, or a developer account would be required to sideload an app. You can technically sideload an app without a paid developer account, but the certificate only lasts seven days, at which point you'd have to reload the application.