|
|
|
|
26
|
* [File access](#user-content-file-access)
|
26
|
* [File access](#user-content-file-access)
|
27
|
* [File stream](#user-content-file-stream)
|
27
|
* [File stream](#user-content-file-stream)
|
28
|
* [Manage cached files](#user-content-cache-file-management)
|
28
|
* [Manage cached files](#user-content-cache-file-management)
|
29
|
-* [Performance Tips](#user-content-performance-tips)
|
|
|
30
|
* [Web API Polyfills](#user-content-web-api-polyfills)
|
29
|
* [Web API Polyfills](#user-content-web-api-polyfills)
|
|
|
30
|
+* [Performance Tips](#user-content-performance-tips)
|
31
|
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
|
31
|
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
|
32
|
* [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting)
|
32
|
* [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting)
|
33
|
* [Development](#user-content-development)
|
33
|
* [Development](#user-content-development)
|
|
|
|
|
652
|
|
652
|
|
653
|
### Performance Tips
|
653
|
### Performance Tips
|
654
|
|
654
|
|
655
|
-React Native connects JS and Native context by passing JSON through RCT bridge, therefore there will an overhead to convert data before they sent. When data is large, this will be quite a performance impact to your app. When upload and download large data it's better to use file storage instead of BASE64 encoding. The following chart show how much faster when loading a data from storage than BASE64 encoded string on iphone 6.
|
|
|
|
|
655
|
+---
|
|
|
656
|
+
|
|
|
657
|
+**Reduce RCT Bridge Overhead and BASE64 Time**
|
|
|
658
|
+
|
|
|
659
|
+React Native connects JS and Native context by passing JSON through RCT bridge, therefore there will an overhead to convert data before they sent. When data is large, this will be quite a performance impact to your app. When upload and download large data it's better to use file storage instead of BASE64 encoding. The following chart shows how much faster when loading a data from storage than BASE64 encoded string on iphone 6.
|
656
|
|
660
|
|
657
|
<img src="img/performance_1.png" style="width : 100%"/>
|
661
|
<img src="img/performance_1.png" style="width : 100%"/>
|
658
|
|
662
|
|
659
|
-TODO
|
|
|
|
|
663
|
+**ASCII Encoding has /terrible Performance**
|
|
|
664
|
+
|
|
|
665
|
+Due to the [lack of typed array implementation in JavascriptCore, and limitation of React Native structure](https://github.com/facebook/react-native/issues/1424), to convert data to JS byte array spends lot of time. Use it only when needed, the following chart shows how much time it takes when reading a file with different encoding.
|
660
|
|
666
|
|
|
|
667
|
+<img src="img/performance_encode.png" style="width : 100%"/>
|
661
|
|
668
|
|
662
|
## Changes
|
669
|
## Changes
|
663
|
|
670
|
|