elementary / files

File browser designed for elementary OS
https://elementary.io
GNU General Public License v3.0
322 stars 75 forks source link

Scrolling stuttery in folder with lots of photos #1767

Open kdwk opened 3 years ago

kdwk commented 3 years ago

What Happened

When scrolling with a touchpad in a folder with lots of photos, frame rate drops significantly so that the scrolling experience is not smooth. This only happens in grid view with thumbnails, but not in list view or column view. This does not happen in folders with lots of other types of content, like PDF files, even with thumbnails

https://user-images.githubusercontent.com/39268094/126248805-2cc84bba-5c4e-470b-9193-5865c333c2d7.mp4

Expected Behavior

Scrolling in any folder should be smooth with touchpads

Steps to Reproduce

  1. Import lots of photos into a folder
  2. Scroll in grid view
  3. Observe. Repeat with folder full of PDF files or other types of files

Logs

Platform Information

Screenshot from 2021-07-20 09-35-44

Screen resolution: 1920*1080

CPU governor is already set to 'performance'

jeremypw commented 3 years ago

After importing lots of photos into a folder it will take a significant amount of time and cpu cycles for the system thumbnailer to create and index the thumbnails. This could explain the poor performance compared with files that are easier to thumbnail or do not have a thumbnail. It is long known that Gtk.IconView (on which the grid view is based) does not scale well to very large numbers of files (several thousand or more) and it is better to use ListView in that case. There is reluctance to write and support a custom high performance widget - hopefully a suitable upstream one will eventually be available.

The Photos app handles large numbers of photos better.

kdwk commented 3 years ago

My folder has only 61 photos. That’s why I’m filing a bug report — I would expect that 61 photos is a piece of cake for a modern operating system, and indeed it is for other file managers, since Nautilus handles them just fine, no performance issues. I have already set the CPU governor to ‘performance’. For your information, thumbnails are already created for all photos. No thumbnail creation task or file indexing task is going on as far as I am concerned. Besides, performance is just as bad in the Photos app. The ‘open window’ and ‘close window’ animations have low frame rates, which does not happen to any other app.

jeremypw commented 3 years ago

Oh yes, for 61 photos there should not be a problem - I've not noticed anything. If Photos is also affected that a bit puzzling as the widget used is completely different. What size and format are the photos? Do they reside on a local or remote storage?

jeremypw commented 3 years ago

If you run htop or Gnome system monitor can you identify a process taking lots of cpu?

jeremypw commented 3 years ago

Looking at your video, it is quite hard to see any stuttering tbh.

Just tried using System Monitor and on an i5 machine scrolling List View and Grid View with about 80 photos both consumed about 40% cpu.

kdwk commented 3 years ago

https://user-images.githubusercontent.com/39268094/126440337-d9dafa73-28d9-419d-8995-d396916a938e.mp4

I recorded another video, in which I hope the stutter is more pronounced. For your information, the photos are all PNG screenshots that are stored locally in the Home/Pictures/Screenshots folder.

kdwk commented 3 years ago

http://kdwk.tplinkdns.com/index.php/s/WMNxbND5EcLppYS

I've got another video showing resource usage when running htop, a screen recorder, a few apps, and scrolling in Files

jeremypw commented 3 years ago

Looks like the CPU usage for Files scrolling is about 40% in your case too. Issue #162 may be related but it is hard to identify the cause(s). I notice that a similar CPU consumption occurs in Photos scrolling and that the Xorg process consumes up to 60% cpu during scrolling in both case. So I suspect the cause is mainly upstream. If an equivalent app that uses the Gtk framework on X but does not have this problem can be found it would be interesting to study its code :wink:

kdwk commented 3 years ago

If an equivalent app that uses the Gtk framework on X but does not have this problem can be found it would be interesting to study its code 😉

When I say Nautilus doesn’t have this issue, I meant Nautilus on Wayland (Gnome, Wayland, Fedora 34 Silverblue). I’ll be sure to try it again

MichelFrade commented 3 years ago

https://user-images.githubusercontent.com/16271692/129212363-43193012-837a-483c-b9cd-e86f8936ca2b.mp4