3 ms·
The primary React Native performance issue on iOS is that Apple disables the JIT when using JavaScriptCore. If you run some JS in a WKWebView you should see it
by cellularmitosis 6y ago
The primary React Native performance issue on iOS is that Apple disables the JIT when using JavaScriptCore. If you run some JS in a WKWebView you should see it speed up by 5 to 10x. (WKWebView runs in a different process, so they allow the JIT)
- Cthulhu_ 6y agoTo be anal, the root cause of that is using javascript instead of building a native app. 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)
- JUNGLEISMASSIVE 6y agoThe security implications of running JS in an interpreter and running native bytecode are very different, though. Native apps also routinely request much more permissions and gather extra user data such as contacts, just because it is possible to do so.
- notsureaboutpg 6y agoRight, and since using Javascript has such poor performance over using a native app on iOS, and since developers prefer to use Javascript instead of build multiple native apps, Hermes exists to bring Javascript performance closer to native app performance. Way better to have a tool that helps Javascript performance than to burden developers with having to write native iOS/Android apps separately
- afavour 6y agoArguably the primary React Native performance issue is that JS is single-threaded. Does React Native provide any useful tools for that?
- spullara 6y agoYou can run things in workers: https://github.com/devfd/react-native-workers https://github.com/devfd/react-native-workers
- nicoburns 6y agoThat's not the primary issue. The main issue that there isn't (or wasn't until recently) a fast, low overhead way to communicate between JavaScript and native code. That's changing with JSI, and I think we might find React Native gets a lot faster in practice if they ever complete the work.