Skip to content

Optimize directory loading

Testing phase.

Fixes #20 (closed) primarily, but also fixes #37 (closed) (see #37 (comment 38056)), and fixes #22 (closed) since progressive loading is removed. Also drastically reduces the problem for #32 (closed) (see #32 (comment 38052)).

This MR allows to gain an order of magnitude in the overall complexity of the directory loading process (scanning the directory, adding files to the list, adding images to the thumbnail bar, clearing the thumbnail bar between two loads), by decreasing it from quadratic to linear.

But this is only an upper bound, because in detail (see the messages of the concerned commits), some steps go from O(n) to O(1) (especially where there were a lot of disk accesses) and the constants in these evaluations are globally improved.

In practice, a directory of 10,000 files that was almost impossible to load on a small laptop like mine, now loads in a few seconds the first time, and in a second the second time (probably because of the disk cache). In accordance with the linear complexity, a directory with 20,000 files loads in about two seconds, and a directory with 30,000 files in about three seconds.

An optimization is also made to the thumbnail bar drawing and the requests to Tumbler, which also greatly improves the smoothness of the thumbnail bar scrolling for these large image numbers.

Edited by Gaël Bonithon

Merge request reports

Loading