Skip to content

perf: optimize Notification Listener via synchronous memory caching#206

Merged
D4vidDf merged 1 commit into
masterfrom
feature/improve-notification-listiner
Jun 8, 2026
Merged

perf: optimize Notification Listener via synchronous memory caching#206
D4vidDf merged 1 commit into
masterfrom
feature/improve-notification-listiner

Conversation

@D4vidDf

@D4vidDf D4vidDf commented Jun 8, 2026

Copy link
Copy Markdown
Owner
  • Data & Persistence:
    • Memory Caching: Introduced a ConcurrentHashMap memory cache in AppPreferences to provide near-instant access to configuration settings without database or DataStore overhead.
    • Reactive Sync: Implemented getAllFlow() in SettingsDAO to keep the memory cache automatically synchronized with the underlying Room database.
    • Synchronous Accessors: Added a suite of synchronous "Sync" getters (e.g., getGlobalConfigSync, getAppIslandConfigSync) to bypass coroutine suspension for performance-critical operations.
  • Service & Performance:
    • Notification Processing: Refactored NotificationReaderService to use synchronous preference lookups, eliminating the need for suspend modifiers and .first() flow collection in the notification processing pipeline.
    • Logic Optimization: Reordered logic in onNotificationPosted to perform the isAppAllowed check before launching a coroutine job, reducing unnecessary object allocation.
    • Resource Usage: Reduced background service overhead and improved battery life by minimizing I/O operations during high-frequency notification events.
  • Localization:
    • Changelog Updates: Updated English and Spanish (ES-rES, ES-rEM) resources for v0.5.2, highlighting the background service architecture overhaul and its impact on performance and battery life.

- **Data & Persistence**:
    - **Memory Caching**: Introduced a `ConcurrentHashMap` memory cache in `AppPreferences` to provide near-instant access to configuration settings without database or DataStore overhead.
    - **Reactive Sync**: Implemented `getAllFlow()` in `SettingsDAO` to keep the memory cache automatically synchronized with the underlying Room database.
    - **Synchronous Accessors**: Added a suite of synchronous "Sync" getters (e.g., `getGlobalConfigSync`, `getAppIslandConfigSync`) to bypass coroutine suspension for performance-critical operations.
- **Service & Performance**:
    - **Notification Processing**: Refactored `NotificationReaderService` to use synchronous preference lookups, eliminating the need for `suspend` modifiers and `.first()` flow collection in the notification processing pipeline.
    - **Logic Optimization**: Reordered logic in `onNotificationPosted` to perform the `isAppAllowed` check before launching a coroutine job, reducing unnecessary object allocation.
    - **Resource Usage**: Reduced background service overhead and improved battery life by minimizing I/O operations during high-frequency notification events.
- **Localization**:
    - **Changelog Updates**: Updated English and Spanish (ES-rES, ES-rEM) resources for v0.5.2, highlighting the background service architecture overhaul and its impact on performance and battery life.
@D4vidDf D4vidDf merged commit 6c20908 into master Jun 8, 2026
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.

1 participant