Skip to content

Conversation

@kewde
Copy link
Contributor

@kewde kewde commented Apr 18, 2025

Summary:

The Release flag is being used for iOS but interestingly, on Android it is optimized for size.
I haven't done any performance testing but from my experience within our react native application, we have noticed that Hermes on iOS devices generally runs much faster than comparable Android devices.

We'll be conducting performance testing on our hermes fork & inside our own application soon but I don't have numbers yet.
LTO was also recently enabled in #50529 which may also affect performance which makes estimating the isolated performance impact of this PR alone a bit more complicated.

Size changes:

  • hermes-release.aar went from 6.9 MB to 9.2 MB on our fork.
  • hermes-release.aar/jni/{arch}/libhermes.so
    • arm64-v8a: 1.8 MB -> 2.3 MB
    • armeabi-v7a: 1.3 MB -> 1.8 MB
    • x86: 2.2MB -> 3.2MB
    • x86_64: 2MB -> 2.7 MB

Changelog:

[ANDROID] [CHANGED] - build hermes release version optimized for speed rather than size

Test Plan:

  • Does the libhermes dynamic library change a lot in size?
  • Is the performance difference worth it?

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Apr 18, 2025
@kewde
Copy link
Contributor Author

kewde commented Apr 21, 2025

We've profiled a production release of these changes on our application and haven't seen statistically significant performance improvements with this release flag change.
It's worth noting, we're on a pretty old version of hermes & compiling with Clang 12 - you may see different results with the latest hermes & latest compilers.

@cortinico
Copy link
Contributor

We've profiled a production release of these changes on our application and haven't seen statistically significant performance improvements with this release flag change.
It's worth noting, we're on a pretty old version of hermes & compiling with Clang 12 - you may see different results with the latest hermes & latest compilers.

Were you able to profile against main as that should provide the most valuable metrics here

@kewde
Copy link
Contributor Author

kewde commented Apr 22, 2025

@cortinico

I'll try and repeat the experiment for 0.78 - which is only 85 commits behind of master of hermes, that might be more representative of the latest state of hermes. The hermes version that we are using was about ~1500 commits behind master :|

@cortinico
Copy link
Contributor

The Release flag is being used for iOS but interestingly, on Android it is optimized for size.

Also @cipolleschi just pointed out how Android and iOS are actually aligned:

if [[ $BUILD_TYPE == "Debug" ]]; then
# JS developers aren't VM developers.
# Therefore we're passing as build type Release, to provide a faster build.
cmake_build_type="Release"
else
cmake_build_type="MinSizeRel"
fi

@kewde
Copy link
Contributor Author

kewde commented Apr 22, 2025

@cortinico

Good call out, I was looking at upstream hermes - I actually wasn't aware that react native shipped a copy of these

upstream definitely has Release set insize of MinSizeRel
https://github.com/facebook/hermes/blob/11c154bc365447648fa56fdd67a1c142034b85a6/utils/build-apple-framework.sh#L7-L11

@cortinico
Copy link
Contributor

Good call out, I was looking at upstream hermes - I actually wasn't aware that react native shipped a copy of these

Yeah the React Native ones are the relevant one as we're the integrator of Hermes in this particular instance

@cortinico cortinico closed this Apr 23, 2025
@kewde kewde deleted the patch-1 branch April 23, 2025 08:34
kewde added a commit to ExodusMovement/hermes that referenced this pull request Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants