Yes that is what I had determined, that taking the modified time into account was not necessary and in fact could only slow things down. However, since the original bug was that the library rescan is slower than it should be I've been investigating where that can be improved.
The primary delay in rescanning when there have been no changes is where we are marking as verified the existing directory and tracks in these two calls:
on my machine these calls take about 100ms each. I believe this is primarily due to the disk writes, and not due to Indexes or preparing the queries (I investigated both pre-preparing the queries instead of preparing them on demand and adding an index on track_locations.directory, both of which had very little effect [LibraryHashes.directory_path is a PK so is already indexed])
A very simple method to significantly improve the speed is to wrap these two calls in a transaction, that causes us to do just a single write instead of two, speeding up my own rescan by more than a third from 95s to 60s. I've attached the small patch for this.
Yes that is what I had determined, that taking the modified time into account was not necessary and in fact could only slow things down. However, since the original bug was that the library rescan is slower than it should be I've been investigating where that can be improved.
The primary delay in rescanning when there have been no changes is where we are marking as verified the existing directory and tracks in these two calls:
m_libraryHashDa o.updateDirecto ryStatus( dirPath, false, true); markTracksInDir ectoryAsVerifie d(dirPath) ;
m_trackDao.
on my machine these calls take about 100ms each. I believe this is primarily due to the disk writes, and not due to Indexes or preparing the queries (I investigated both pre-preparing the queries instead of preparing them on demand and adding an index on track_locations .directory, both of which had very little effect [LibraryHashes. directory_ path is a PK so is already indexed])
A very simple method to significantly improve the speed is to wrap these two calls in a transaction, that causes us to do just a single write instead of two, speeding up my own rescan by more than a third from 95s to 60s. I've attached the small patch for this.