This repository can be used for benchmarking react-native versions for old and new architecture on sample app.
git clone https://github.com/dream11/rn-benchmarking.git
cd Benchamrking
yarn install
- Before running benchmarking on old architecture we need to make sure it's enabled.
- Open android/gradle.properties and make sure newArchEnabled is set to false.
- Run app using
yarn android
. - The benchmarking numbers can be found under ExternalDirectoryPath of emulator storage.
- The path will be /storage/emulated/0/Android/data/com.benchamrking/files/oldarch.json
- Before running benchmarking on old architecture we need to make sure it's enabled.
- Run the following command to enable old architecture.
cd ios export NO_FLIPPER=1 && bundle install && bundle exec pod install rm -rf build
- Run app using
yarn ios
. - The benchmarking numbers can be found under app's DocumentDirectoryPath.
- To get access to app's document directory run the following command:
open $(xcrun simctl get_app_container booted com.benchamrking data)
- After running the above benchmarking numbers can be found under Documents/oldarch.json.
- Before running benchmarking on new architecture we need to make sure it's enabled.
- Open android/gradle.properties and make sure newArchEnabled is set to true.
- Run app using
yarn android
. - The benchmarking numbers can be found under ExternalDirectoryPath of emulator storage.
- The path will be /storage/emulated/0/Android/data/com.benchamrking/files/newarch.json
- Before running benchmarking on new architecture we need to make sure it's enabled.
- Run the following command to enable old architecture.
cd ios export NO_FLIPPER=1 && bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install rm -rf build
- Run app using
yarn ios
. - The benchmarking numbers can be found under app's DocumentDirectoryPath.
- To get access to app's document directory run the following command:
open $(xcrun simctl get_app_container booted com.benchamrking data)
- After running the above benchmarking numbers can be found under Documents/newarch.json.
- Getting benchmarking number's manually by clicking on buttons sometimes be tedious.
- In order to resolve this we have provided some automations scripts that can do this job for you.
- This scripts will help getting numbers for time taken to render N views, texts, images component and flashlight score for spin animations of N views.
- Run the following to get rendering time of N views, texts, images (tested on Android emulator & iOS Simulator):
yarn get:numbers:android <ITERATION_COUNT> /* Example: yarn get:numbers:android 10 */ yarn get:numbers:ios <ITERATION_COUNT> /* Example: yarn get:numbers:ios 10 */
- Run the following command to get flashlight score (supported only on Android):
yarn get:flashlight:score <ITERATION_COUNT> /* Example: yarn get:flashlight:score 10 Defaults to 1 iteration */
- Check flashlight score by running:
flashlight report <PATH_TO_FLASHLIGHT_REPORT> /* Example: flashlight report ../Reports/0.73.5/android/flashlightscore.json (assuming you are inside Benchamrking/ directory) */
NOTE:
- After running automation scripts the benchmarking numbers can be found under Reports directory.
- So, if we are benchmarking for react-native version 0.73.5 the rendering benchmarking numbers will be found under Reports/0.73.5/android for android & Reports/0.73.5/ios for iOS for both architecture
- Since flashlight is only supported on android the flashlight score can be found under Reports/react-native-version/android
- https://github.com/react-native-community/RNNewArchitectureLibraries?tab=readme-ov-file
- reactwg/react-native-new-architecture#123
- https://github.com/react-native-community/RNNewArchitectureApp/tree/new-architecture-benchmarks
- The repository has a simple webpage build to compare performance of different react-native versions for rendering N views, texts & images.
- Please head to https://dream11.github.io/rn-benchmarking/Webpage/index.html to compare the benchmarking numbers.
See CONTRIBUTION.md to learn how to contribute to the repository and the development workflow.
See LICENSE to understand more about terms and conditions.
Instrested in taking a look at the demonstration! You can view or download the video from here.