4 ms·
You can tell it's react native if it lags (at all). No native app should lag on a modern phone. I wrote an app that locally loops over 5MB of JSON and then sor
by ReverseCold 8y ago
You can tell it's react native if it lags (at all). No native app should lag on a modern phone.
I wrote an app that locally loops over 5MB of JSON and then sorts it based on a datetime string (which is converted to a date class) - and it does this every few seconds. You can't tell that this is happening though, because the phone doesn't lag. It doesn't even use a significant amount of battery. It just works.
I wrote the same app in React Native + NativeBase earlier, and even though I implemented that in a smarter way, the app still lagged. Even just a general react native app that doesn't do anything weird just feels "off" sometimes.
Source: Wrote the same app 4 times (Swift, Java, React Native, Flutter) - Flutter was the clear winner, and a joy to work with.
- jtchang 8y agoDid you see any lag when using Flutter?
- ReverseCold 8y agoThe "hot-reload" development builds (which I think run JIT) definitely do lag, but my production bundle is almost indistinguishable from a native app.
- hardwaresofton 8y agoAnother really cool thing about how flutter works is that it gives you much more confidence about how things will render and work on iOS -- drawing every pixel would look like insanity to any onlooker before the project existed, but now that they've done it, and basically faithfully recreated Apple's UI, it's more of the process you can do without actually owning an iphone/ios development machine.
- village-idiot 8y agoTo be fair, apps can lag because of network latency and poor use of blocking calls. But you’re right in general.
- d4l3k 8y agoThe nice thing about React Native is that you can always write native code if necessary. Though, I've used plenty of laggy native apps, so it's more about the software engineering behind it than the technology used. Additionally, with JS most code runs on the UI thread unlike most native apps. If you use a web worker with RN you'd get similar behavior to your native app. https://github.com/devfd/react-native-workers https://github.com/devfd/react-native-workers
- afro88 8y agoPlenty of native apps lag, for a variety of reasons. I do agree that RN apps have a greater probability of lagging though.
- rawrmaan 8y agoNot true! Play my game Falcross (https://www.falcross.com https://www.falcross.com) on iOS or Android and tell me if you feel any lag. It's written in React Native. Less than 3% of the UI is native code. You CAN make highly performant software, even games, with React Native. You just need to take the time to truly understand the platform, and you will reap massive benefits.
- hardwaresofton 8y agoThank you so much for posting this. Did you write about your work anywhere? There are tradeoffs to picking frameworks like React Native & co. but there just aren't enough people writing about their usecases and the performances they saw/tuning they were able to do. Eventually I'd like to make an example app in ~3 of the alternatives (native, nativescript, flutter) and use appium to do comparisons and various timing.
- rawrmaan 8y agoI haven't written much about it except in comments here on HN. I agree there should be more out there, I hope I can find the time to do some writing.
- ReverseCold 8y agoCool! I play that game. Here's a very unscientific test (showing GPU usage) I did on the Note 8 switching between menus really quickly. It's barely noticeable (if at all) for me, but it certainly shows on older phones. Canvas for Android (Native): https://i.imgur.com/5mWueG7.png https://i.imgur.com/5mWueG7.png Falcross Menu: https://i.imgur.com/DpKVNDK.jpg https://i.imgur.com/DpKVNDK.jpg (It's also important to note that this isn't noticeable at all on iOS. The app is buttery smooth with a consistent framerate on iOS.) Other than that, a few nitpicks: The "recently played" icon at the top is clipped for me, the energy/star/circle icons at the top flicker when you switch views, etc. Things like that basically don't happen if you use "real" native development (or Flutter) with "real" native components.
- mankash666 8y ago
- hardwaresofton 8y agoHey thanks for sharing your experience -- have you written about this anywhere? I'd love to read up on what you've been through. I personally want to go through the process you've gone through (except replace react native with nativescript) to see how it feels. I like Flutter but I just don't want to commit to dart, but it represents an entry in the hybrid continuum (native -> webview) that can't be ignored because of how it works. One thing though -- looping through 5MB of JSON doesn't seem like something you should be doing... [EDIT] - Just saw your other comment with the render comparison pictures -- thanks so much for the input!
- ReverseCold 8y agoI have a few posts about Flutter and app development in general, but they were mostly just to blow off steam (content-light) and aren't exactly well thought out: https://nikhiljha.com/blog https://nikhiljha.com/blog I do plan to write a better comparison about the whole development lifecycle, performance, etc. later though. I'd also like to urge you to reconsider dart. It feels kind of like a Kotlin-Java hybrid language, and I mean that in the best way possible. It's definitely familiar to anyone who has programmed OOP before, so it was really easy for me to get started with zero experience. > One thing though -- looping through 5MB of JSON doesn't seem like something you should be doing... I agree. I should get to fixing that.
- hardwaresofton 8y agoThanks for the blog link! definitely going to start reading! Have you seen the Flutter Show[0]? It's actually a pretty good watch, though I'm a little skeptical/suspicious of how hard the marketing team of Flutter is pushing things, it reeks of when subpar/fledgling projects try to advertise/market themselves to greatness. Then again, the way Flutter works is pretty novel for the space so it's clearly not a marketing-only play. Upfront I want to say that I fully recognize that disregarding dart is a childish thing to do, I mean to try building a not-bad flutter app as early as this weekend (I got my fill of nativescript-vue recently and liked it but want to see what else is out there), also I've watched and read enough about flutter that it's about time that I actually built something with it. Also, I'm not a fan of Java's semantics and ergonomics (though it's better than a large group of other languages), but I do always hear nice things about Kotlin. I've programmed in OOP but don't really want to any more -- structs + methods + interfaces/typeclasses/traits (i.e. golang, haskell and rust) are like 100% of what I want out of "OOP" approaches now, don't want the rest that comes with it in java land. On that note, what do you think about Reactive programming (relatively recently announced as BLoCs in flutter)? I'm not sure I actually like trying to have primary data processing paradigm for applications, but I know it's a very popular approach -- I find an Observable gets you 99% to where you want to be, and observables are almost (if not completely) equivalent to streams but no one wants to do that, day 2 mobile app data management seems to almost always be "let's add streams". [0]: https://www.youtube.com/playlist?list=PLOU2XLYxmsIK0r_D-zWcmJ1plIcDNnRkK https://www.youtube.com/playlist?list=PLOU2XLYxmsIK0r_D-zWcm... [EDIT] - I particularly like these two posts in sequence on your blog: - https://nikhiljha.com/blog/how-to-write-android-apps-in-2018 https://nikhiljha.com/blog/how-to-write-android-apps-in-2018 - https://nikhiljha.com/blog/a-reflection-how-to-actually-write-apps https://nikhiljha.com/blog/a-reflection-how-to-actually-writ...
- shady-lady 8y ago> Flutter was the clear winner, and a joy to work with. It also has that big red 'Google built this' flag, opensource not withstanding. Feels way riskier using it than any of the first 2 or even the 3rd.