2 ms·
I agree with you, that for the same 'business logic', having it JavaScript vs native, unless you do lots of sorting/copying of data -- will not have battery imp
by maga_2020 8y ago
I agree with you, that for the same 'business logic', having it JavaScript vs native, unless you do lots of sorting/copying of data -- will not have battery impact difference.
However, React itself (not the javascript engine) brings in additional dimensions, that are somewhat unique to react.
For example, React's (and therefore ReactNative) TextInput control, essentially (in my understanding) encourages you to update a state variable, every single time type a letter into that control
(because the values displayed in the control are coming from the state, so the only way to display the character you typed, is via updating the state).
So that round trip of the character update, to updating the object with state variable, calling .setState, forcing the re-rendering, will consume more battery power. In my view
(I know textinput in particular has the 'uncontrolled model').
My point, that the constant 'create new object', update the state with it, and Re-render -- could be slower (and less battery efficient), than doing may be something similar (or more efficient) in Native Code.