Repository navigation
perf: optimize startup without functional change (#99 #100 #101 #102) - #104
Open
shreyashp47 wants to merge 5 commits into
Open
shreyashp47 wants to merge 5 commits into
shreyashp47 wants to merge 5 commits into
Conversation
- #99: eliminate runBlocking DataStore in attachBaseContext DoTrackApplication.getLanguageCodeSync now reads SharedPreferences sync cache (dotrack_sync_prefs) instead of runBlocking dataStore.first(); UserPreferencesRepositoryImpl dual-writes language to sync prefs; Application.onCreate migrates existing DataStore value async - #100: fix StartupProvider removal - WorkManagerInitializer and EmojiCompatInitializer now correctly removed via provider merge; verified merged manifest only keeps ProcessLifecycle + ProfileInstaller - #101: add SplashScreen API (androidx.core:core-splashscreen 1.0.1) Theme.DoTrack.Splash + installSplashScreen() in MainActivity for perceived startup 200-400ms, postSplashScreenTheme -> Theme.DoTrack - #102: startup cleanup * WallpaperGenerator wallpaperManager by lazy, dateFormatter companion, 7 prefs reads now concurrent via async/coroutineScope * DatabaseModule uses addMigrations(MIGRATION_1_2,2_3,3_4) instead of fallbackToDestructiveMigration() * Theme: cache dynamic colorScheme + priorityCardColors with remember, remove SideEffect global mutation; TaskComponents now uses LocalPriorityCardColors * DateTimeConverters formatter to companion object * TasksViewModel single tasksResultFlow shared upstream, taskCounts derived from same flow (single Room observer) * Widget updatePeriodMillis 300000 -> 0 (rely on TaskWidgetUpdater) No user-visible behavior change, assembleDebug + testDebugUnitTest green Experimental branch for startup work
…ontext cast Fixes Build and Deploy failure on experimental@01e7ab0 /app/src/main/java/com/shreyash/dotrack/MainActivity.kt:117 lint error Use androidx.activity.compose.LocalActivity.current Verified locally, no functional change
Previous beta track already has 53 (run 30335669059), so increment to unblock experimental beta deploy
…lay beta Main advanced to 1.55 via 3 automated bumps (53,54,55) while experimental was on 1.53 - merge to sync version, next beta will be 1.56/56
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Optimize app startup without functional change. Addresses performance audit (cold start → first frame / TTI) while keeping all user-visible behavior identical.
Branch:
experimental→mainCloses #99, #100, #101, #102 ( #103 deferred to follow-up — needs emulator for BaselineProfile generation).
Changes
#99 — Eliminate main-thread blocking in
attachBaseContextapp/src/main/java/com/shreyash/dotrack/DoTrackApplication.kt:20-46—getLanguageCodeSync()now readsSharedPreferences(dotrack_sync_prefs)(~1ms) instead ofrunBlocking { dataStore.data.first() }(30-150ms). DataStore remains source of truth.data/src/main/java/com/shreyash/dotrack/data/repository/UserPreferencesRepositoryImpl.kt:239— dual-write language to sync prefs onsetLanguage.DoTrackApplication.onCreateasync migrates existing DataStore value to sync prefs (one-time for upgrades).#100 — Fix StartupProvider misconfiguration
app/src/main/AndroidManifest.xml:22— correctprovider tools:node="merge"removingWorkManagerInitializer+EmojiCompatInitializer. WorkManager is provided viaDoTrackApplication : Configuration.Provider.processDebugMainManifestnow onlyProcessLifecycleInitializer+ProfileInstallerInitializer(was 4).#101 — SplashScreen for perceived startup
gradle/libs.versions.toml:15+app/build.gradle.kts:91—androidx.core:core-splashscreen:1.0.1app/src/main/res/values/themes.xml:10—Theme.DoTrack.Splash(postSplashScreenTheme→Theme.DoTrack, background@color/splash_background)app/src/main/java/com/shreyash/dotrack/MainActivity.kt:73—installSplashScreen()beforesuper.onCreate,app/src/main/res/values/colors.xmlnewsplash_background#7C3AED.#102 — Startup cleanup (actual TTI)
app/src/main/java/com/shreyash/dotrack/core/util/WallpaperGenerator.kt:47,58—wallpaperManager by lazy, formatters cached, 7 DataStore reads now concurrent viaasync/coroutineScope(was sequential).data/src/main/java/com/shreyash/dotrack/data/di/DatabaseModule.kt:27—addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4)instead offallbackToDestructiveMigration()(aligns withTaskDatabase.kt:57).core/src/main/java/com/shreyash/dotrack/core/ui/theme/Theme.kt:72—remembercachesdynamicColorScheme+priorityCardColors, removedSideEffectglobal mutation;app/src/main/java/com/shreyash/dotrack/ui/tasks/TaskComponents.kt:80now usesLocalPriorityCardColors.data/src/main/java/com/shreyash/dotrack/data/util/DateTimeConverters.kt:7— formatter tocompanion object.app/src/main/java/com/shreyash/dotrack/ui/tasks/TasksViewModel.kt:98— singletasksResultFlowshared upstream (taskCountsderived, single Room observer instead of 2).app/src/main/res/xml/task_widget_info.xml:8—updatePeriodMillis300000 → 0 (rely onTaskWidgetUpdater).No functional change
attachBaseContext, 13+ viaLocaleManagerinSettingsViewModel.TaskSorter/CompositionLocal.Testing
./gradlew assembleDebug— BUILD SUCCESSFUL./gradlew testDebugUnitTest— 27 tests pass (TaskSorterTest 7, SettingsViewModelTest 14, TasksViewModelOrderingTest 5)WorkManagerInitializer/EmojiCompatInitializerconnectedAndroidTestrun (needs emulator); Macrobenchmark deferred to [Perf] Add Baseline Profiles + startup tracing + indexing #103Estimated improvement
Follow-up
reportFullyDrawn()+ covering index — separate PR once emulator baseline generation is done.cc @shreyashp47