194 points · by dgellow · 5y ago · 73 comments
Looks like it's available for iOS now too :)
Announcing React Native 0.64 with Hermes on iOS https://reactnative.dev/blog/2021/03/12/version-0.64
This prevents JIT's but does not prevent an interpreter from functioning since an interpreter does not directly generate machine code and execute it, it simply reads the code to interpret as data and executes through its own engine.
Most modern JS engines JIT which is why you don't see say electron / node / chromium based stuff on iOS, a lot of it has to do with V8 requiring the ability to JIT.
Hermes does not JIT so it sidesteps the technical limitations on iOS then its just a matter of passing review.
There where some ways around this that have been patched and Apple has recent introduced an official entitlement but does not allow it in the app store yet:
https://saagarjha.com/blog/2020/02/23/jailed-just-in-time-co...
https://9to5mac.com/2020/11/06/ios-14-2-brings-jit-compilati...
Now that I think of it though, I think the Apple ToS that prohibit browsers are about function (app used to browse the web) rather than internals (language support in the engine).
> 2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the Application completely viewable and editable by the user.
Basically embedding any interpreted language inside the app is frowned upon by apple. But historically they have allowed JavaScript and Lua scripts to be embedded in apps.
The recent XBox dashboard has been remade with it.
I get that Facebook has the biggest apps on any platform and they run into platform limitations (like number of classes on Android) and build cycles so for them it makes sense to make a dynamic partial-hot-reloading-in-place app development framework, but they're still beholden to the runtime that Apple offers them.
(In theory they could compile JS to a compiled binary that Apple's reviewers are okay with, but I don't know enough about any of that)
All JS improvements for the last 10 years required a lot of bypassing of browser and device maker’s implementation.
And still there are root exploits that are about to go all the way back up
I like react-native, as in the architecture (nativescript has a better bridge). Unfortunately it’s JavaScript. I guess we’ll have to deal with it another 40 years min.
[0] https://github.com/facebook/react-native/issues/25986 and related issues
Scroll down to: How Hermes improves React Native performance
> Hermes today has no JIT compiler. This means that Hermes underperforms some benchmarks, especially those that depend on CPU performance. This was an intentional choice: These benchmarks are generally not representative of mobile application workloads.
What workloads are different from mobile application workloads, other than server-side code?
> Because JITs must warm up when an application starts, they have trouble improving TTI and may even hurt TTI. Also, a JIT adds to native code size and memory consumption, which negatively affects our primary metrics. A JIT is likely to hurt the metrics we care about most, so we chose not to implement a JIT.
So it seems to be specific to their TTI (Time To Interact) metric. A server application generally has the time to warm-up to reach best-performances (pretty common in the java world for example) while a mobile application has to react to user inputs as soon as possible.
The speed of a JS vm factoring primes doesn't indicate how laggy it'll feel scrolling through a list because it's garbage collecting every few hundred millis.
that was a while ago though.
code with
80 column hard
limit
looks bad.