perf: cap hero decode, lower desktop image eviction threshold
This commit is contained in:
+3
-6
@@ -417,8 +417,8 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
|
||||
if (PlatformDetector.isDesktopOS()) {
|
||||
_memoryCheckTimer = Timer.periodic(const Duration(seconds: 30), (_) {
|
||||
final rss = ProcessInfo.currentRss;
|
||||
if (rss > 1536 * 1024 * 1024) {
|
||||
// 1.5GB
|
||||
if (rss > 1024 * 1024 * 1024) {
|
||||
// 1GB
|
||||
appLogger.w('RSS high ($rss bytes), evicting image caches');
|
||||
_evictImageCaches();
|
||||
}
|
||||
@@ -592,10 +592,7 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
|
||||
// SQLite WAL mode handles process death; desktop uses onExitRequested.
|
||||
InAppReviewService.instance.endSession();
|
||||
if (PlatformDetector.isDesktopOS()) {
|
||||
if (ProcessInfo.currentRss > 1024 * 1024 * 1024) {
|
||||
// 1GB
|
||||
_evictImageCaches();
|
||||
}
|
||||
_evictImageCaches();
|
||||
}
|
||||
case AppLifecycleState.inactive:
|
||||
case AppLifecycleState.hidden:
|
||||
|
||||
@@ -1382,11 +1382,18 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
imageType: ImageType.art,
|
||||
);
|
||||
|
||||
final (_, memHeight) = PlexImageHelper.getMemCacheDimensions(
|
||||
displayWidth: (screenWidth * dpr).round(),
|
||||
displayHeight: (heroHeight * dpr).round(),
|
||||
imageType: ImageType.art,
|
||||
);
|
||||
|
||||
return blurArtwork(
|
||||
CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
cacheManager: PlexImageCacheManager.instance,
|
||||
fit: BoxFit.cover,
|
||||
memCacheHeight: memHeight,
|
||||
placeholder: (context, url) =>
|
||||
ColoredBox(color: Theme.of(context).colorScheme.surfaceContainerHighest),
|
||||
errorWidget: (context, url, error) =>
|
||||
|
||||
Reference in New Issue
Block a user