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

Optimise DependencyModule.resolveDependencies #1680

Merged
merged 1 commit into from
May 10, 2022

Conversation

lemnik
Copy link
Contributor

@lemnik lemnik commented May 6, 2022

Goal

Improve Bugsnag startup performance by optimising DependencyModule.resolveDependencies

Design

Removed future

The future property delegate had two undesirable impacts:

  1. The delegate object itself had several allocations that were only used during startup (the delegate itself, the construction Function, and a wrapper for the construction Function)
  2. Before the DependencyModule objects could be allocated there was a reflection overhead brought about by the KProperty objects

Removed the use of Future.get

DependencyModule.resolveDependencies always waited for its background task to complete before returning. This PR moves the waiting to the first references of the values, by hiding the properties behind a resolveValueOf function which will wait (if required) for the background task to complete.

Testing

Relied on existing tests

@lemnik lemnik force-pushed the PLAT-8334/optimise-resolve-dependencies branch from cb7f83c to cc6a1f7 Compare May 6, 2022 15:21
@lemnik lemnik requested a review from kstenerud May 6, 2022 15:48
@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 0.0 0.0
arm64_v8a 0.0 0.0
armeabi_v7a 0.0 0.0
x86 0.0 0.0
x86_64 0.0 0.0

Generated by 🚫 Danger

@lemnik lemnik force-pushed the PLAT-8334/optimise-resolve-dependencies branch 2 times, most recently from 16015f6 to 3270ef5 Compare May 10, 2022 09:28
…edValueOf` to avoid reflection during startup and reduce the number of objects that need to be allocated
@lemnik lemnik force-pushed the PLAT-8334/optimise-resolve-dependencies branch from 3270ef5 to 1d930a8 Compare May 10, 2022 09:28
@lemnik lemnik merged commit 93a224b into next May 10, 2022
@lemnik lemnik deleted the PLAT-8334/optimise-resolve-dependencies branch May 10, 2022 12:46
@lemnik lemnik mentioned this pull request May 11, 2022
This was referenced May 24, 2022
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.

3 participants