bugsnag / bugsnag-android

BugSnag crash monitoring and reporting tool for Android apps
https://www.bugsnag.com/platforms/android/
Other
1.18k stars 205 forks source link

NDK: Iterate over breadcrumb metadata keys directly #2022

Closed lemnik closed 4 months ago

lemnik commented 4 months ago

Goal

Remove the allocation of an ArrayList when copying the metadata for breadcrumbs.

Design

The NDK bsg_populate_crumb_metadata method now uses the Map.entrySet.iterator() instead of first copying the keys to an ArrayList and then iterating over that (using Map.get for the values). While this is a relatively trivial overhead reduction, it has the added benefit that most Map implementation optimize this form of iteration, and avoid the allocation overhead of the ArrayList.

Testing

Manual testing, and relied on existing end to end tests.

bugsnagbot commented 4 months ago

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1844.32 1668.69
arm64_v8a 626.95 450.82
armeabi_v7a 561.42 385.29
x86 700.66 524.53
x86_64 671.99 495.86

Generated by :no_entry_sign: Danger