perf: skip getting package class name inside expo module #2487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Recently blog post regarding performance improvements inside autolinking was published, as it turns between implementations there's a big difference.
After my investigation it is due getting package class name from classes which are implementing
ReactPackage
orTurboReactPackage
. In past we landed improvements to this logic (read more here).But as mentioned in the blog post the difference is still big and the root cause of this issue is because of reading hundreds of files from expo modules and trying to find classes that implements
ReactPackage
orTurboReactPackage
, but expo modules don't implementReactPackage
orTurboReactPackage
directly inside their source code, so the return value will be anywaynull
, so it doesn't make sense to read hundreds of files and check for classes that implementsReactPackage
orTurboReactPackage
.Inside this Pull Request I've added a early return if module is expo module, following logic doesn't affect output of
config
command because expo modules follows other rules and are included in native build in different way.Exception is
expo
package itself which containsexpo-module.config.json
and also implementsReactPackage
orTurboReactPackage
, I added appropriate condition for this case.Benchmark:
Tested on the
react-conf-app
.Before:
After:
Test Plan:
Checklist