Live data from Hacker News

How Discord achieves native iOS performance with React Native

blog.discordapp.com

81–90 of 115 posts

Re: How Discord achieves native iOS performance with React Native

#81
Some people, when confronted with having to develop a mobile app on Android and iOS, think “I know, I'll use React Native.” Now they have three problems: Android, iOS and React Native.

My company has both natively developed Android and iOS apps, as well as a few RN apps. I'm in the developer tooling part of the company. Indeed, the RN apps did allow those teams to add developers who had only JavaScript coding experience. But at the cost of a lot of additional complexity elsewhere in the company. Now we effectively have to support three platforms in our build system, in our SDKs, and so forth.

I'm fairly confident that it is not a net win. Those RN developers eventually have to learn the weird idiosyncrasies of both Android and iOS besides the idiosyncrasies added by RN itself. They now have bugs that show up on only one platform because RN Android is using a different JS engine than RN iOS.

There's just a gigantic amount of complexity added by RN on-top of the gigantic amount of complexity you already get with Android and iOS.

In the end, at best you end up with a mediocre cross-platform app. I think RN probably has a sweet spot: a small to medium sized app developed by a sole or maybe a few developers. Once you're big enough to have teams of developers, I think RN is a mistake.

With respect to this article, the amount of work and expertise in both RN and iOS necessary to achieve their performance goals seems pretty extreme ("mobile performance squad"). And this was all just for iOS? Did any of it translate to their RN Android app? It's a counter factual so who knows, but I suspect the performance problems wouldn't have occurred on a native app in the first place, and if they had, would've been straightforward to track down in Instruments. They claim all this work is offset by allowing their web app developers to contribute to the RN app and that it allowed them to develop the iOS app more quickly, but I have my doubts. As it is, they've got three developers dedicated to the RN iOS app alone and despite that, still ran into performance problems.

Again, maybe they have enough shared code and developers to make it worthwhile, but I dunno.

Re: How Discord achieves native iOS performance with React Native

#82

Once i have a dream about RN application for iOS/Android without Xcode and AndroidStudio. Started with Expo, great tool if you don't have native modules. But i have, very complex search library in Rust. After few attempts the code was converted to asmjs (RN doesn't support wasm). So i have JS-only codebase that works on Expo. Livecoding (a bit slow beause of large js codebase) and easy deploymnet on all platforms. Af…

May want to also look at MS/Xamarin development, I know a few people that really like it. Though, RN seems a bit more popular. For that matter, in what ways is JS unpredictable? Generally combined with Redux or something similar, I've found it to be fairly consistent and predicatble.

Re: How Discord achieves native iOS performance with React Native

#83
post #65

Why, in the "Battery Heat" section is there a link on the small d in Discord that leads to http://watchanimeattheoffice.com/ , which apparently redirects to discordapp.com. So weird!

> Why, in the "Battery Heat" section is there a link on the small d in Discord that leads to http://watchanimeattheoffice.com/, which apparently redirects to discordapp.com. So weird!

Pssst ...

https://twitter.com/discordapp/status/1088195791355703296

Re: How Discord achieves native iOS performance with React Native

#84
post #81

Some people, when confronted with having to develop a mobile app on Android and iOS, think “I know, I'll use React Native.” Now they have three problems: Android, iOS and React Native. My company has both natively developed Android and iOS apps, as well as a few RN apps. I'm in the developer tooling part of the company. Indeed, the RN apps did allow those teams to add developers who had only JavaScript coding experie…

I don't think size of app is the concern. It's what your app does. We have a pretty large CRM style app. React Native is a huge help. Since it's just forms and table displays mostly, there isn't a lot of platform specific code we have to create. Maybe 10 or so edge cases where we maintain some differing RN code to make things work well on both platforms.

Re: How Discord achieves native iOS performance with React Native

#86
post #84
post #81

Some people, when confronted with having to develop a mobile app on Android and iOS, think “I know, I'll use React Native.” Now they have three problems: Android, iOS and React Native. My company has both natively developed Android and iOS apps, as well as a few RN apps. I'm in the developer tooling part of the company. Indeed, the RN apps did allow those teams to add developers who had only JavaScript coding experie…

I don't think size of app is the concern. It's what your app does. We have a pretty large CRM style app. React Native is a huge help. Since it's just forms and table displays mostly, there isn't a lot of platform specific code we have to create. Maybe 10 or so edge cases where we maintain some differing RN code to make things work well on both platforms.

Fair enough, that's probably right. My opinion is highly colored by seeing mostly the cost of RN and few of the benefits sitting where I do in the tech stack.

Re: How Discord achieves native iOS performance with React Native

#87
post #81

Some people, when confronted with having to develop a mobile app on Android and iOS, think “I know, I'll use React Native.” Now they have three problems: Android, iOS and React Native. My company has both natively developed Android and iOS apps, as well as a few RN apps. I'm in the developer tooling part of the company. Indeed, the RN apps did allow those teams to add developers who had only JavaScript coding experie…

> Those RN developers eventually have to learn the weird idiosyncrasies of both Android and iOS besides the idiosyncrasies added by RN itself.

Ha, you know React runs in web browsers, right? React developers should already be used to having their code run in various JS engines (Gecko/Blink/Webkit and SpiderMonkey/V8/Nitro).

Re: How Discord achieves native iOS performance with React Native

#88
post #84
post #81

Some people, when confronted with having to develop a mobile app on Android and iOS, think “I know, I'll use React Native.” Now they have three problems: Android, iOS and React Native. My company has both natively developed Android and iOS apps, as well as a few RN apps. I'm in the developer tooling part of the company. Indeed, the RN apps did allow those teams to add developers who had only JavaScript coding experie…

I don't think size of app is the concern. It's what your app does. We have a pretty large CRM style app. React Native is a huge help. Since it's just forms and table displays mostly, there isn't a lot of platform specific code we have to create. Maybe 10 or so edge cases where we maintain some differing RN code to make things work well on both platforms.

We do mostly Line of Business (LoB) apps and depending on the required target platforms and desired quality, we usually use Forms, Avalonia (recently) or Livecode. As CTO, I have a small budget for research, so every 6-12 months I try a project in something else by timeboxing something trivial and hiring an expert in another technology to see how that goes.

In our experience RN loses, for our kind of applications (so I am not saying this is universally true!), from all 3 the above mentioned technologies in cost, time to implement and long term stability. We have apps running for many years while requiring fixes/feature additions in the meanwhile and that cannot cost a lot as they are small features/fixes. Requiring to refactor/fix things after updates of the platform is just not an option as we do not have many resources. We had incredibly bad experiences (in backend tech, so apples/pears but still) in that regard with Ruby/Rails and js/npm; that is great for big dedicated teams with continues development. We had great experience with ASP.NET (old+new) and Django; stuff just works after years and not much knowledge is needed to go from one major version to another (it did not take us much work to go from asp.net to asp.net core for instance).

Flutter definitely seems promising ; the foreign function interfacing is much better than RN (imho) and it just seems less like a mess. We will keep evaluating Flutter while working on/with Xamarin Forms (apps), Avalonia (desktop) and Livecode (everything).

This is for LoB applications like you seem to target as well; for consumer facing apps, we write native on all platforms, but that really does not happen often in my line of work.

Re: How Discord achieves native iOS performance with React Native

#89

Once i have a dream about RN application for iOS/Android without Xcode and AndroidStudio. Started with Expo, great tool if you don't have native modules. But i have, very complex search library in Rust. After few attempts the code was converted to asmjs (RN doesn't support wasm). So i have JS-only codebase that works on Expo. Livecoding (a bit slow beause of large js codebase) and easy deploymnet on all platforms. Af…

May want to also look at MS/Xamarin development, I know a few people that really like it. Though, RN seems a bit more popular. For that matter, in what ways is JS unpredictable? Generally combined with Redux or something similar, I've found it to be fairly consistent and predicatble.

About five years ago i have a dream, that i can abandon all this peasant C/C++ development and jump into mono/xamarin train. As a main product we have Linux ARM/MIPS karaoke machine with optional remote control via desktop/mobile apps. The idea was to use same code every where.

- Tooling for Linux was horrible, like really! - Alien mobile UI look and feel - One can not simple build mobile app for desktop. - New shiny search engine prototype doesn't fit into low tier Phone RAM. - Mono Hello world application on MIPS device with 128RAM uses about 28 mb of RAM. - 400 MHz cpu have really hard times with GC, nogo for soft-realtime. - No seamless integration with native code, using libs like ffmpeg is crazy hard. - F# was 2nd citizen in that time!

Now things changed, but still imho Linux is not a good choose for .net, also MS force you to use Azure/Cloud/etc infrastructure.

Re: How Discord achieves native iOS performance with React Native

#90

React Native is excellent for web teams that are creating a new mobile app. If your team has more experience with React than native iOS/Android, then it's a no-brainer. However, in my experience you get diminishing returns once your app has passed v1 and your customers expect more after the new-ness wears off. You find yourself spending more and more engineering effort to make your RN app to feel as good as existing…

Blog author here. As a native app developer, I would say that the trade off is similar to developing an app on native Android vs. native iOS.

You inevitably must solve problems on Android that iOS has not yet solved (or are trivially easy to do) and vice versa, but each framework also has its own strengths that come with it.

React Native is no different in this regard. We sometimes solve different problems that occasionally area easier to do on Native (although as mentioned by this post, this is the first time in years we've actually had to sit down and focus on performance).

That being said, some of the pros are that we save a tremendous amount of time through code sharing, web team contributions, etc.

Post reply on HN