sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

refactor: native FFI for Android and Cocoa SDK

Open vaind opened this issue 2 years ago • 5 comments

:scroll: Description

This is an evaluation/PoC for integration of the iOS/macOS (a.k.a. Cocoa) SDK as well as Android (Java) SDK via direct FFI invocation, avoiding method channels.

Tracking issue: #1444

Currently, this PR only ads the configuration & code generated to make the necessary change & I've tested a full call roundtrip for both SDKs.

:bulb: Motivation and Context

:green_heart: How did you test it?

:pencil: Checklist

  • [ ] I reviewed submitted code
  • [ ] I added tests to verify changes
  • [ ] No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • [ ] I updated the docs if needed
  • [ ] All tests passing
  • [ ] No breaking changes

:crystal_ball: Next steps

Decide whether we want to go ahead and implement this fully - replacing the functionality currently implemented in platform-specific method channels.

vaind avatar Sep 01 '23 15:09 vaind

Android Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 346.02 ms 421.12 ms 75.10 ms
Size 6.16 MiB 7.18 MiB 1.02 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
fcd1ee46299294dbd1f2040a50690d1b37e7c1d6 298.96 ms 376.04 ms 77.09 ms
870f5ebb0389ee8870a702da61188f0c7826b7e1 329.45 ms 369.29 ms 39.84 ms
fe4aa568d4e0feae9d53a7f83659aa2a5ab50b22 356.06 ms 428.67 ms 72.61 ms
0db91ccbfaec953eb629db000f6a6034aa04e2c8 327.85 ms 387.31 ms 59.46 ms
7ade5af85bc00839aa6788a05725d7f9ecda0b6d 341.04 ms 386.84 ms 45.80 ms
d7758e8c1a1884d46734ccb197dbcde683bc4189 300.12 ms 349.88 ms 49.76 ms
457a85b8ec19fd620aeaece65af00ca66c93c4d1 312.37 ms 376.67 ms 64.31 ms
bf4aed726e9adcfe8b364aef9d0870dd2c4ad5fe 311.24 ms 365.66 ms 54.42 ms
b728df439473e146f8721c7555cd54728a93b6cb 390.98 ms 445.81 ms 54.83 ms
f2db4ece59961760d0017bb7b0592fc561ab79f0 372.46 ms 469.72 ms 97.26 ms

App size

Revision Plain With Sentry Diff
fcd1ee46299294dbd1f2040a50690d1b37e7c1d6 6.16 MiB 7.13 MiB 1000.85 KiB
870f5ebb0389ee8870a702da61188f0c7826b7e1 5.94 MiB 6.92 MiB 1005.77 KiB
fe4aa568d4e0feae9d53a7f83659aa2a5ab50b22 6.06 MiB 7.10 MiB 1.04 MiB
0db91ccbfaec953eb629db000f6a6034aa04e2c8 5.94 MiB 6.95 MiB 1.01 MiB
7ade5af85bc00839aa6788a05725d7f9ecda0b6d 5.94 MiB 6.95 MiB 1.01 MiB
d7758e8c1a1884d46734ccb197dbcde683bc4189 5.94 MiB 6.95 MiB 1.01 MiB
457a85b8ec19fd620aeaece65af00ca66c93c4d1 6.06 MiB 7.09 MiB 1.03 MiB
bf4aed726e9adcfe8b364aef9d0870dd2c4ad5fe 6.06 MiB 7.03 MiB 997.04 KiB
b728df439473e146f8721c7555cd54728a93b6cb 5.94 MiB 6.95 MiB 1.01 MiB
f2db4ece59961760d0017bb7b0592fc561ab79f0 6.06 MiB 7.03 MiB 990.27 KiB

Previous results on branch: refactor/native-ffi

Startup times

Revision Plain With Sentry Diff
84d609cbe919fa9acde4edd1e14f41954cbceca1 339.49 ms 409.26 ms 69.77 ms

App size

Revision Plain With Sentry Diff
84d609cbe919fa9acde4edd1e14f41954cbceca1 6.16 MiB 7.18 MiB 1.02 MiB

github-actions[bot] avatar Sep 01 '23 15:09 github-actions[bot]

Fails
:no_entry_sign: Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- native FFI for Android and Cocoa SDK ([#1622](https://github.com/getsentry/sentry-dart/pull/1622))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by :no_entry_sign: dangerJS against ae34a422b9ecac6a267cdf0935ac3f5daaf08d89

github-actions[bot] avatar Sep 01 '23 15:09 github-actions[bot]

iOS Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1245.24 ms 1247.15 ms 1.91 ms
Size 8.29 MiB 9.38 MiB 1.09 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
211a7aa7596aabdf67c027fb55761c803504fbf1 1258.02 ms 1275.65 ms 17.63 ms
f0fcbe1432e5c9ffab835fe700c5c061fb52aa98 1238.08 ms 1243.44 ms 5.36 ms
55cc6ef4d04f84084d60cda78ef75eed7bb7b378 1271.92 ms 1281.04 ms 9.12 ms
ddc97adb5918b9f9eda573656e6edd9401b17801 1228.02 ms 1232.61 ms 4.59 ms
6aab859f42bd361abd466a8fdfb0ddcaf7f8cca4 1245.14 ms 1247.59 ms 2.45 ms
e893df57266c8bbe00cb0e1dfcc876875fc4debe 1247.90 ms 1262.31 ms 14.41 ms
6572f8d71180920b30f2c566a955504cb215ecb1 1242.16 ms 1246.63 ms 4.47 ms
6d7a391cf23411c9ac5147ce5b236f117a8345cc 1265.65 ms 1289.98 ms 24.33 ms
56810ff730b5c918da021c12c84ee1cd88d62aa1 1267.59 ms 1293.48 ms 25.89 ms
1e781fc5e1c54f79c131767c203e01ab1ccd0abd 1257.96 ms 1281.49 ms 23.53 ms

App size

Revision Plain With Sentry Diff
211a7aa7596aabdf67c027fb55761c803504fbf1 8.10 MiB 9.18 MiB 1.08 MiB
f0fcbe1432e5c9ffab835fe700c5c061fb52aa98 8.29 MiB 9.38 MiB 1.09 MiB
55cc6ef4d04f84084d60cda78ef75eed7bb7b378 8.10 MiB 9.18 MiB 1.08 MiB
ddc97adb5918b9f9eda573656e6edd9401b17801 8.29 MiB 9.37 MiB 1.08 MiB
6aab859f42bd361abd466a8fdfb0ddcaf7f8cca4 8.29 MiB 9.36 MiB 1.07 MiB
e893df57266c8bbe00cb0e1dfcc876875fc4debe 8.09 MiB 9.07 MiB 1001.04 KiB
6572f8d71180920b30f2c566a955504cb215ecb1 8.29 MiB 9.36 MiB 1.07 MiB
6d7a391cf23411c9ac5147ce5b236f117a8345cc 8.16 MiB 9.16 MiB 1.01 MiB
56810ff730b5c918da021c12c84ee1cd88d62aa1 8.15 MiB 9.12 MiB 987.35 KiB
1e781fc5e1c54f79c131767c203e01ab1ccd0abd 8.10 MiB 9.18 MiB 1.08 MiB

Previous results on branch: refactor/native-ffi

Startup times

Revision Plain With Sentry Diff
84d609cbe919fa9acde4edd1e14f41954cbceca1 1229.24 ms 1234.31 ms 5.07 ms

App size

Revision Plain With Sentry Diff
84d609cbe919fa9acde4edd1e14f41954cbceca1 8.29 MiB 9.38 MiB 1.09 MiB

github-actions[bot] avatar Sep 01 '23 15:09 github-actions[bot]

Codecov Report

Patch has no changes to coverable lines.

:exclamation: Current head ae34a42 differs from pull request most recent head 8367da2. Consider uploading reports for the commit 8367da2 to get more accurate results

Files Changed Coverage
...r/lib/src/integrations/native_sdk_integration.dart ø

:loudspeaker: Thoughts on this report? Let us know!.

codecov[bot] avatar Sep 01 '23 15:09 codecov[bot]

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Oct 18 '23 07:10 getsantry[bot]

closing because

  • cocoa FFI has already been in use for profiling for a while
  • java FFI is coming for replay in another PR

vaind avatar Apr 23 '24 11:04 vaind