Understanding React Native performance(part-1)

The holy grail of any coding effort is to ensure a code written once runs on every platform : web/iOS/android etc. We are not there yet. But there are a few contenders in the right direction. React native is the new kid on the block promising cross platform code reusability across iOS and android and the ability to write all that using js/css and html (mostly). I have been working on it for close to 2 years now and I love it and so do a lot of other people. It does have the ability to become the defacto standard to write cross platform mobile app code. However its important to understand what its strengths and pitfalls all to make a judicious decision.

Ideally one would write everything natively. Yes, native does and will always give you the best performance. It true today and in future if anything ever replaces react-native. But its cost prohibitive and slow. What react-native does is that it takes the js/css/html and attaches it to your app as an asset, just like a jpeg etc. This bundle is installed on the device and spits out native widgets at runtime via the magic done in the library. Its kinda like a client server architecture where the client is the screen (or the native side) and the server is the js bundle. They communicate everything via a bridge process which is the bottleneck. All events/ network requests etc pass back and forth over this to make a functional app. If you start running into performance issues the process is to start looking at how much traffic is over the bridge and attempt to reduce that.

要查看或添加评论,请登录

Nikit P.的更多文章

社区洞察

其他会员也浏览了