Setup a Macrobenchmark for RNTester#49486
Setup a Macrobenchmark for RNTester#49486janicduplessis wants to merge 9 commits intofacebook:mainfrom
Conversation
9b44cbb to
5ede103
Compare
|
Thanks for looking into those @janicduplessis 🙏 |
|
@cortinico Do you think we should try to merge this? I was thinking it could be useful to manually test perf improvements. Would be nice to run on ci too, but might be hard with the current setup since it seems to only make sense to run on physical device. If so I can remove the changes to rn-tester and fake bundle size increase. |
|
In general, I'd like to have such a thing merged. The problem is that this might slow down all the rn-tester gradle builds (because it adds a new build variant that we use like once in a while). So I'd rather keep it as a branch or PR around for when we need it |
|
@cortinico Let me check the impact on gradle build time, if its negligible I think we can merge it. |
a7c9517 to
bb284dd
Compare
I think that as we enabled Gradle Config Cache today, this is probably going to be small (and ok to maintain) |
bb284dd to
5b52b81
Compare
|
@cortinico Should we try to avoid having the benchmark variants built on CI or that's fine? I think it gets built because of this line here that includes all projects that use the gradle-plugin https://github.com/janicduplessis/react-native/blob/224fe93fecc17d98170888060b2b91872e1e2bf8/build.gradle.kts#L90. |
We'll have to do something like this: https://stackoverflow.com/a/34337260 |
|
Turns out we can just remove the benchmark variant and it still works fine using the hermesRelease variant instead. |
|
From looking at ci logs it looks like the benchmark project does get built, but takes around 2 seconds so should be fine. |
cortinico
left a comment
There was a problem hiding this comment.
Thanks for cleaning this up @janicduplessis
packages/rn-tester/android/app/benchmark/src/main/AndroidManifest.xml
Outdated
Show resolved
Hide resolved
...-tester/android/app/benchmark/src/main/java/com/example/benchmark/ExampleStartupBenchmark.kt
Outdated
Show resolved
Hide resolved
|
I addressed the comments, once the PR to bump appcompat version lands I will rebase this and should be good to go! |
Summary: Update androidx app compat to the latest version. This is needed as part of #49486 to have access to `fullyDrawnReporter`. ## Changelog: [ANDROID] [CHANGED] - Update androidx app compat to 1.7.0 Pull Request resolved: #49594 Test Plan: Tested in RN tester that it builds fine and works properly. Reviewed By: Abbondanzo Differential Revision: D69988202 Pulled By: cortinico fbshipit-source-id: 0329aa84a76327db535ddba8acf059ebbf1dbdfc
c77737d to
60b9a3b
Compare
|
Rebased |
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
...-tester/android/app/benchmark/src/main/java/com/example/benchmark/ExampleStartupBenchmark.kt
Outdated
Show resolved
Hide resolved
7549616 to
6b636ad
Compare
|
@janicduplessis can we make sure the JS tests are green also? |
Summary: Tests have been executed with Android Studio: **Startup** ``` # BEFORE timeToInitialDisplayMs min 216.9, median 222.9, max 245.3 Traces: Iteration 0 1 2 3 4 5 6 7 8 9 # AFTER timeToInitialDisplayMs min 213.8, median 220.4, max 237.9 Traces: Iteration 0 1 2 3 4 5 6 7 8 9 ``` **APK size** ``` -rw-r--r-- 1 ncor staff 20087367 Feb 17 17:37 before.apk -rw-r--r-- 1 ncor staff 20087399 Feb 17 18:43 after.apk ``` Changelog: [Internal] [Changed] - Differential Revision: D69753053
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
6b636ad to
cd0ee78
Compare
|
Fixed! |
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@cortinico ReportFullyDrawnView actually doesn't need to wrap the app, I moved it and hopefully that solves the issue. |
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@cortinico merged this pull request in b614c96. |
|
This pull request was successfully merged by @janicduplessis in b614c96 When will my fix make it into a release? | How to file a pick request? |
Summary:
Benchmark to test changes from #49449
Might be nice to have some version of this in the repo.
Changelog:
[INTERNAL] [ADDED] - Setup a Macrobenchmark for RNTester
Test Plan:
Methodology
Picked various JS file from websites (facebook, instagram) to artificially grow RN tester bundle somewhat realistically. The files are required lazily from a button press callback to simulate the code being included, but not executed, as it would be in a large app that uses lazy requires for the different screens.
I've also made the RN tester screens lazy so all their code is not loaded initially. This is more representative of real apps. Note this is implemented in a hacky way just for the purpose of this test. It would actually be nice to implement this properly.
The tests were made using low end device Samsung Galaxy A03s.
Compression ON with 10.5 mb bundle
Peak allocated memory
60.9 mb
ReactInstance.loadJSBundler
148.64 ms
Benchmark
timeToFullDisplayMs min 1,825.0, median 1,911.1, max 1,994.8
timeToInitialDisplayMs min 834.9, median 860.9, max 903.9
APK
Size: 22.9 mb
Download size: 14.5 mb
Compression OFF with 10.5 mb bundle
Peak allocated memory
51.5 mb
ReactInstance.loadJSBundler
946 us
Benchmark
timeToFullDisplayMs min 1,752.8, median 1,827.2, max 1,977.5
timeToInitialDisplayMs min 837.7, median 881.3, max 937.2
APK
Size: 28 mb
Download size: 14.5 mb