files icon indicating copy to clipboard operation
files copied to clipboard

Improve load speed

Open jeremypw opened this issue 3 years ago • 3 comments

Partially fixes #1794 Partially fixes #1422 Partially fixes #1939 Fixes #1987 Fixes #1996

Advantage is taken of the fact that when initially loading a directory, the model is empty and unsorted and only root level items are loaded. A new simpler, faster method for adding all the files in the directory (filtered according to hidden file setting) in one operation is introduced and similar methods for loading subdirectories.

Also, rather than emitting and processing a signal for every file as it is loaded into the Directory object, a single signal is emitted once all the files have been loaded.

Further improvement is made by not fully updating the file from the info until the file is actually displayed. When initially loaded we only need to set the properties needed by the model sorting/filtering.

This greatly reduces the time taken to initially construct the model (more than a factor of 10). The main delay becomes laying out the IconView.

This will not fix issues related to large modifications of a loaded directory, those will be addressed in a future PR.

jeremypw avatar Dec 21 '21 18:12 jeremypw

Example for 20000 (small) files: This PR TIme to emit "done-loaded" signal approx 1.5 seconds Show ListView (total, approx): <2 seconds Show IconView (total, approx): 20 seconds

Master TIme to emit "done-loaded" signal approx 192 seconds Show ListView (total, approx) 194 seconds Show IconView (total, approx) 224 seconds

This shows there has been a regression in the time taken to load the Directory object and construct the model such that for large folders it dominates the total time taken to show the view.

In this PR the loading and construction of the model is approaching 100x faster and for IconView the laying out of the View dominates.

Note: the done-loaded signal triggers reconnection of the model to the view and starts the laying out.

jeremypw avatar Dec 23 '21 16:12 jeremypw

Difference is night and day, an incredible improvement.

You probably already noticed but the directory icons are initially document like icons? Screen record from 2022-01-29 16 15 24 Screen record from 2022-01-29 16 13 21

peteruithoven avatar Jan 29 '22 15:01 peteruithoven

@peteruithoven Thanks for the comment! Yes, I need to find some time to work on regressions.

jeremypw avatar Jan 29 '22 17:01 jeremypw

Closing as too old. May incorporate ideas into Gtk4 version.

jeremypw avatar Feb 19 '23 17:02 jeremypw