Small and somewhat untested optimisation.
authorCarl Hetherington <cth@carlh.net>
Fri, 5 Jan 2018 01:00:21 +0000 (01:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 5 Jan 2018 01:00:21 +0000 (01:00 +0000)
src/lib/image_content.cc

index 191359ff35a8e35c822215cf98abb3a4d4073674..5262064af797313feb97c2f0dceab35bc946c251 100644 (file)
@@ -105,11 +105,15 @@ ImageContent::examine (shared_ptr<Job> job)
 {
        if (_path_to_scan) {
                job->sub (_("Scanning image files"));
+               int n = 0;
                for (boost::filesystem::directory_iterator i(*_path_to_scan); i != boost::filesystem::directory_iterator(); ++i) {
                        if (boost::filesystem::is_regular_file (i->path()) && valid_image_file (i->path())) {
                                _paths.push_back (i->path ());
                        }
-                       job->set_progress_unknown ();
+                       ++n;
+                       if ((n % 1000) == 0) {
+                               job->set_progress_unknown ();
+                       }
                }
 
                if (_paths.empty()) {