perf: optimize providers, caching, and reduce rebuilds

- Cache SharedPreferences.getInstance() in providers (settings, theme, recent_access)
- Pre-compute download counts in queue provider to avoid repeated filtering
- Add identical() caching for RecentAccessView in HomeTab
- Use selective watching for exploreProvider (sections, greeting, isLoading only)
- Move isYTMusicQuickPicks computation to ExploreSection.fromJson()
- Hoist static RegExp patterns to avoid repeated compilation
- Use batch operations for iOS path migration in history_database
- Replace containsKey+lookup with single lookup in palette_service
- Pre-compute lowercase strings outside filter loops in logger
- Fix _isLoaded race condition in DownloadHistoryNotifier
This commit is contained in:
zarzet
2026-01-22 03:56:47 +07:00
parent 55b75dc48d
commit 6388f3a5b8
17 changed files with 287 additions and 155 deletions
+5 -3
View File
@@ -159,15 +159,17 @@ class LogBuffer extends ChangeNotifier {
}
List<LogEntry> filter({String? level, String? tag, String? search}) {
final tagLower = tag?.toLowerCase();
final searchLower = search?.toLowerCase();
return _entries.where((entry) {
if (level != null && level != 'ALL' && entry.level != level) {
return false;
}
if (tag != null && !entry.tag.toLowerCase().contains(tag.toLowerCase())) {
if (tagLower != null && !entry.tag.toLowerCase().contains(tagLower)) {
return false;
}
if (search != null && search.isNotEmpty) {
final searchLower = search.toLowerCase();
if (searchLower != null && searchLower.isNotEmpty) {
return entry.message.toLowerCase().contains(searchLower) ||
entry.tag.toLowerCase().contains(searchLower) ||
(entry.error?.toLowerCase().contains(searchLower) ?? false);