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 initial tracings + a few startup optimizations. #169

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

ychescale9
Copy link
Member

Add initial tracing calls:

  • OkHttpClient creation
  • ApolloClient creation
  • Coil ImageLoader creation
  • Home screen feed list
  • SyncWorker#doWork

Optimizations:

  • remove redundant additional OkHttpClient creation when initializing ImageLoader
  • remove httpEngine configuration in ApolloClient creation to use injected Call.Factory instead of the default one created by the httpEngine DSL that takes timeout
  • remove unnecessary FeedSyncEngine injection in KSApp
  • add initial delay for SyncWorker request to avoid worker initialization during startup

Currently OkHttpClient initialization happens early in the main thread as ApolloClient.Builder#okHttpCallFactory is eager.

image

The initialization can be deferred and moved to a background thread once apollographql/apollo-kotlin#5784 is released.

Latest startup benchmark results:

StartupBenchmark_startupCompilationBaselineProfiles
timeToFullDisplayMs      min 412.7,   median 439.2,   max 614.2
timeToInitialDisplayMs   min 374.0,   median 394.1,   max 473.0

StartupBenchmark_startupCompilationNone
timeToFullDisplayMs      min 485.9,   median 503.5,   max 698.6
timeToInitialDisplayMs   min 404.9,   median 415.2,   max 467.0

@ychescale9 ychescale9 merged commit dc97e5d into main Apr 8, 2024
5 checks passed
@ychescale9 ychescale9 deleted the add-tracing branch April 8, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant