flint / Lurker

Resource Tracking
http://lurker.rtfd.org
MIT License
179 stars 24 forks source link

Change DirectoryResource::getModificationTime to return the modified time of the directory itself #5

Closed romainneutron closed 10 years ago

romainneutron commented 10 years ago

Hello,

I've a question about DirectoryResource::getModificationTime implementation that have great impact on performance :

I've noted that the modification time value of the DirectoryResource is impacted by the files contained in it (see implementation). It seems it could be bypassed, using the directory mtime (by removing the previously mentioned lines). Doing this, I got performance x10 : scanning a folder containing 9300 files in 2400 folders take 0.8 second whereas it takes about 9 seconds with the current implementation.

The DirectoryResource::getModificationTime method is only used in ResourceStateChecker::getChangeset to get time modification (useful in case of create / delete). For the modify event, it could be used (trigger a directory MODIFY event in case its content has changed) but it's discarded in the DirectoryStateChecker::getChangetSet (see implementation)

So I would consider removing this, feedback appreciated.

henrikbjorn commented 10 years ago

Only question is if the directory mtime changes based on the files in it? It would be logical to assume it does.