Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sdk size to readme #2587

Merged
merged 7 commits into from
Jan 28, 2025
Merged

Add sdk size to readme #2587

merged 7 commits into from
Jan 28, 2025

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented Jan 20, 2025

#skip-changelog

Add sdk size to readme

Closes #2437

@denrase
Copy link
Collaborator Author

denrase commented Jan 20, 2025

@buenaflor Seems illogical that the Dart only SDK would be larger than Dart Flutter on Android. Is this something we should look more into?

@denrase denrase marked this pull request as ready for review January 20, 2025 14:23
@buenaflor
Copy link
Contributor

@denrase I'm not sure tbh, it could also be that android does more aggressive optimizations but I think yea it makes sense to investigate a bit

@denrase
Copy link
Collaborator Author

denrase commented Jan 21, 2025

@buenaflor Should we do this separately from this PR?

@buenaflor
Copy link
Contributor

as discussed, let's check this again, maybe also build the apps locally in release mode with obfuscation on to check how it compares to the data we get from the CI

@denrase
Copy link
Collaborator Author

denrase commented Jan 22, 2025

Checking our build commands, we build all variants in release mode. Android & Dart (Console) are build for a specific architecture, while iOS API should contain multiple architectures. So it would make sense that the former are larger than the latter.

Can't say why Android is smaller than dart only on linux though.

iOS

args="--release --no-codesign"

The IPA containsu artifacts for multiple architectures as well as symbols.

Android

We build for a specific ABI.

Removing the --split-per-abi flag results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that aren't applicable to their device's architecture.

args="--release --target-platform android-arm64 --split-per-abi"

Dart (Console)

dart compile exe perf_test_console_sentry/bin/perf_test_console_sentry.dart -o ./perf_test_console_sentry.bin

Accorind to subcommands docs:

A standalone, architecture-specific executable file containing the source code compiled to machine code and a small Dart runtime.

@denrase
Copy link
Collaborator Author

denrase commented Jan 22, 2025

@buenaflor I added --obfuscate --split-debug-info=. to iOS/Android just to see how the metrics change based on that.

Copy link
Contributor

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1230.71 ms 1248.22 ms 17.51 ms
Size 8.16 MiB 9.55 MiB 1.40 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0a82a1e 1233.56 ms 1244.56 ms 11.00 ms
0210372 1255.49 ms 1280.98 ms 25.49 ms
7fd33d3 1241.92 ms 1265.47 ms 23.55 ms
051e97a 1245.94 ms 1249.51 ms 3.57 ms
d10745a 1251.29 ms 1268.71 ms 17.43 ms
754cdbe 1261.67 ms 1280.88 ms 19.20 ms
8de999e 1267.51 ms 1281.00 ms 13.49 ms
5aba417 1265.31 ms 1287.90 ms 22.59 ms
fec92cc 1237.93 ms 1259.21 ms 21.28 ms
64e4616 1242.80 ms 1270.07 ms 27.27 ms

App size

Revision Plain With Sentry Diff
0a82a1e 8.29 MiB 9.37 MiB 1.08 MiB
0210372 8.38 MiB 9.73 MiB 1.35 MiB
7fd33d3 8.38 MiB 9.78 MiB 1.40 MiB
051e97a 8.28 MiB 9.34 MiB 1.06 MiB
d10745a 8.28 MiB 9.33 MiB 1.05 MiB
754cdbe 8.29 MiB 9.37 MiB 1.08 MiB
8de999e 8.42 MiB 9.88 MiB 1.46 MiB
5aba417 8.16 MiB 9.17 MiB 1.01 MiB
fec92cc 8.33 MiB 9.54 MiB 1.22 MiB
64e4616 8.28 MiB 9.34 MiB 1.05 MiB

@buenaflor
Copy link
Contributor

buenaflor commented Jan 23, 2025

as discussed, let's see if we can replicate the sentry dart sdk size that is shown with the --analyze-size flag

@denrase
Copy link
Collaborator Author

denrase commented Jan 27, 2025

Tested it now with the following commands.

iOS flutter build ipa --release --analyze-size
Andorid flutter build apk --release --target-platform=android-arm64 --analyze-size

With these results.

Platform Plain Sentry Difference
iOS 40.5MB 43.2MB +2.7MB
Android 6.8MB 9.1MB +2.3MB

So the results are somewhat larger and the platforms closer together, probably due to more optimizations for when the apps are downloaded and run on real device hardware.

I would argue it does not matter that much for the documentation. We don't need the exact values, but rather a ballpark of the overhead when using sentry. The purpose of the exact values in CI is for us to see if there is a large change in the overhead with functionality we introduce. So I will update the readme accordingly.

android-plain.txt
ios-flutter.txt
ios-plain.txt
android-flutter.txt

@denrase denrase enabled auto-merge (squash) January 27, 2025 12:33
@buenaflor
Copy link
Contributor

definitely, we just need to be clear why the Linux dart only big might be bigger in case users would wonder about that

Copy link
Contributor

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 460.22 ms 506.33 ms 46.11 ms
Size 6.46 MiB 7.48 MiB 1.02 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b930b94 484.42 ms 525.51 ms 41.09 ms
d8519f9 352.83 ms 420.46 ms 67.62 ms
7ade5af 341.04 ms 386.84 ms 45.80 ms
73d70bf 467.08 ms 546.12 ms 79.04 ms
299a3f6 508.79 ms 563.71 ms 54.93 ms
8776cdf 353.32 ms 416.58 ms 63.26 ms
e893df5 310.60 ms 380.58 ms 69.98 ms
0764150 469.49 ms 541.86 ms 72.37 ms
09c1f55 449.98 ms 509.38 ms 59.40 ms
f2db4ec 372.46 ms 469.72 ms 97.26 ms

App size

Revision Plain With Sentry Diff
b930b94 6.49 MiB 7.57 MiB 1.08 MiB
d8519f9 6.33 MiB 7.26 MiB 946.13 KiB
7ade5af 5.94 MiB 6.95 MiB 1.01 MiB
73d70bf 6.52 MiB 7.59 MiB 1.06 MiB
299a3f6 6.49 MiB 7.56 MiB 1.07 MiB
8776cdf 6.34 MiB 7.28 MiB 966.66 KiB
e893df5 6.06 MiB 7.09 MiB 1.03 MiB
0764150 6.46 MiB 7.48 MiB 1.01 MiB
09c1f55 6.49 MiB 7.55 MiB 1.07 MiB
f2db4ec 6.06 MiB 7.03 MiB 990.27 KiB

Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks good, we'd just need to check this regularly in case this is outdated at some point


## SDK Size Overhead

The Sentry SDKs for Dart and Flutter typically add approximately 1-1.5 MB to an app’s binary size. The exact impact may vary depending on the device architecture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe mention in production builds

@denrase denrase merged commit f85b52d into main Jan 28, 2025
9 of 10 checks passed
@denrase denrase deleted the chore/doc-sdk-size-overhead branch January 28, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document SDK size overhead
2 participants