Benchmark app for measuring some metrics of react-strict-dom.
Boot an iOS Simulator, find its UDID in Xcode's Devices and Simulators window, then run:
npm run benchmark:ios -- --udid <SIMULATOR_UDID>Note that in package.json we use a local directory for react-strict-dom:
"react-strict-dom": "file:../react-strict-dom/packages/react-strict-dom"
Here are some chosen results from running the benchmark:
- using react/react-strict-dom's
main - using three perf/* branches from my fork
- from the
without-rsdbranch from this repo. It's the same app visually but all RSD usage has been replaced with plain React Native
without-rsd was measured so I could get an idea of what the overhead of RSD in retained memory is, in a trivial UI heavy app. I use it as a good enough estimate of the overhead, which is (6.05MB - 1.79MB) = 4.26 MB. I say "good enough" because the app uses some RSD features which are not free in React Native, so it does a little more (e.g. color inheritance), but that accounts for a small part of the overhead?
The goal with the three perf/* branches was to 1. not pay for what you don't use 2. cut memory usage in all cases when it's easy. The main target was amount of retained memory. Combined, they cut that overhead by: 1 - (3.62MB - 1.79MB) / (6.05MB - 1.79MB) = about 57%.
| Version | Commit | Remount retained (MB) | Remount allocated (MB) | Remount render (ms) | Update allocated (MB) | Update render (ms) |
|---|---|---|---|---|---|---|
main |
c877f5c |
6.05 | 21.20 | 27.63 | 13.53 | 23.57 |
without-rsd |
e3c2fb5 |
1.79 | 8.19 | 12.02 | 5.37 | 9.62 |
perf/pseudo-hooks |
e3f9bc4 |
5.17 | 19.31 | 26.27 | 11.84 | 21.73 |
perf/refless-elements |
858cffa |
5.74 | 20.36 | 27.64 | 13.31 | 23.31 |
perf/style-hooks |
ea3bd2b |
4.83 | 19.04 | 26.43 | 12.27 | 22.89 |
All three perf/* combined |
e3f9bc4 + 858cffa + ea3bd2b |
3.62 | 15.22 | 23.52 | 10.46 | 21.05 |