[KPhotoAlbum] Patch to speed up scanning for new images
Robert L Krawitz
rlk at alum.mit.edu
Fri May 11 13:14:43 CEST 2007
Date: Fri, 11 May 2007 10:41:42 +0200
From: "Henner Zeller" <h.zeller at acm.org>
In general, I like the patch as unnecessary stat()s make things
very slow (especially on NFS/SMB or external USB drives .. which is
a typical place for photo libraries).
Using readdir_r/readdir in this way seems fine to me, but please
add a comment saying that this is done similarly qdir_unix.cpp
which probably makes discussion about this topic not as lengthy. Of
course, there might be improvements (esp. I wouldn't allocate this
on the stack).
Regarding the naming, I would probably name this FastDir or
something .. MyDir is not really a useful name. And add
documentation saying what it does (its fast by not doing
stat()). In general, add a little comment to all methods (the
current style of not having comments is doesn't mean that it should
be followed ;-) )
Style wise I'd suggest to make the MyDir::path_ const, as it is
only set once in the constructor. I would not make entryList()
(and hence, the destructor) virtual, since this class is not
overridden anyway. The destructor can go away completely in this
As a friend of simplicity, I would suggest not to add a default
constructor, since it is not used anyway; but as the behaviour of
the current default constructor is very reasonable (take the
current directory) it seems fine to me (but comment it).
Don't forget to remove the SurveyDialog-quietening 'return;' ;-)
Sorry, that one slipped in there (I got fed up with that survey ages
ago and did that in my copy).
More information about the KPhotoAlbum