iced icon indicating copy to clipboard operation
iced copied to clipboard

iced freeze for multiple seconds, if many image are added at the same time

Open LuckyTurtleDev opened this issue 1 year ago • 1 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Is this issue related to iced?

  • [X] My hardware is compatible and my graphics drivers are up-to-date.

What happened?

If I show many (200) Images (100kb each) and add them all at the same view() call iced freeze for multiple seconds. At debug mode it even crash sometimes. If do not show add them all at the same view() step (for example the must be downloaded from the internet first) everything works fine. It looks like iced reads the images from the ssd and blocks the hole app so long.

What is the expected behavior?

not freeze

Version

crates.io release and master

Operating System

Linux

Do you have any log output?

log.txt

LuckyTurtleDev avatar Dec 13 '23 18:12 LuckyTurtleDev

Original example: https://github.com/LuckyTurtleDev/mtg/tree/d83dd32a35cb7030e992d06e233b90f15f223c03 Steps to reproduce:

  • Search for "dragon". Everything works fine now since the image must be loaded from the internet first.
  • Wait a few seconds until everything is fetch.
  • Select "Stock"
  • Go back to "Search" The app freeze now for a few seconds since every image is present at the drive and will be load at the same time now .

So I have impl a second cache to cache the image Handle now, to avoid the lagging. It became a loot faster but still freeze for 1-2 seconds at release mode. https://github.com/LuckyTurtleDev/mtg/tree/e33ef17ea9cfcc30f497cb67ec1d560897c17535

The only option I currently see, to fix this, is to impl a 3 cache, which tracks which image handle was show at the last view step and limit the count of new handles, which will be used to view an image. But this sound even more hack, like the current version. This sound like something, which should be impl in iced instead.

LuckyTurtleDev avatar Dec 14 '23 16:12 LuckyTurtleDev