Primarily used to demonstrate the performance of Hermes vs the other React Native JavaScript engines, such as Chakra & JavaScriptCore (Windows and Android/iOS, respectively).
There are observable differences between the Hermes and Chakra JavaScript engines when a large amount of promises are processed. This was originally tracked against microsoft/hermes-windows issue #92. However, the latest configurations in this library suggest that the issue also persists on Android as well. This project was overhauled to test with Hermes directly for facebook/hermes issue #1024
An application may want to format / sanitize individual fields on data returned from a back-end; such as a Date Time format, capitalization, etc. Likely, this would be done with asynchronous or promise based functions running. This example project seeks to demonstrate that behavior for large data sets of 1,000 and 10,000.
This repository contains a git submodule to hermes-promise-cli and requires initialization before usage. Please either clone with the --recurse-submodules
or perform the following after cloning:
git submodule init
git submodule update
- Perform the necessary configuration steps outlined at React Native's Setting up the development environment (Version 0.71).
Warning iOS has not been tested (but should work)
- Perform the necessary configuration steps outlined at React Native for Windows' Get Started with Windows for 0.71.
Assuming the prerequisites have been fulfilled, using standard React Native command line arguments are all that is needed.
yarn install
yarn react-native start
in one terminal.yarn react-native run-android
oryarn react-native run-ios
in another terminal.
Note Switching between Hermes and JavaScriptCore is possible by following the directions at Switching back to JavaScriptCore (Version 0.71).
yarn install
- Follow the next steps documented at Running a React Native Windows App as directions differ depending on whether the command line is used or the Visual Studio IDE.
Note Switching between Hermes and Chakra is possible by toggling the
UseHermes
field inwindows/ExperimentalFeatures.props
; as noted at Using Hermes in an existing project.
- First select which promise structure to test. Nested Promises consists of multiple promise layers when formatting the fields of each object retrieved, while Flat Promises consists of one promise per field of every object. See the submodule repository code for details.
- On the following screen, first choose an object size to simulate fetching. Note, the console will report the time the fetch took, though this is not the purpose of the test.
- Click on Format, which will then launch a promise chain which changes the casing for every field of every object. The metro bundler will have console entries for the times and a pop up will display for Release mode.