Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Improved speed of DirectoryResource#21440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| $newestMTime =max($file->getMTime(),$newestMTime); | ||
| if ($file->getMTime() <$timestamp) { | ||
| returntrue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
missing;
nicolas-grekas commentedJan 29, 2017
I doubt this really works. |
robfrawley commentedJan 29, 2017
@nicolas-grekas With regard to modification time behavior #!/bin/bashTMPDIR="/tmp/mtime-test/"TMPFILE="$TMPDIR/test-file"TMPINNERDIR="$TMPDIR/test-dir/"TMPINNERFILE="$TMPINNERDIR/test-file"rm -fr$TMPDIR&& mkdir$TMPDIRCREATIONTIME="$(stat -c %Y$TMPDIR)"sleep 2touch$TMPFILETOUCHTIME="$(stat -c %Y$TMPDIR)"if [["$CREATIOBTIME"=="$TOUCHTIME" ]];thenecho":-( Touching inner file doesn't modify time."elseecho":-) Touching inner file modified time!"fiecho"Before Time :$CREATIONTIME"echo -e"After Time :$TOUCHTIME\n"sleep 2echo"IDK">$TMPFILEMODTIME="$(stat -c %Y$TMPDIR)"if [["$TOUCHTIME"=="$MODTIME" ]];thenecho":-( Modifying inner file doesn't modify time."elseecho":-) Modifying inner file modified time!"fiecho"Before Time :$TOUCHTIME"echo -e"After Time :$MODTIME\n"sleep 2mkdir$TMPINNERDIRINNERMKDIRTIME="$(stat -c %Y$TMPDIR)"if [["$MODTIME"=="$INNERMKDIRTIME" ]];thenecho":-( Creating inner dir doesn't modify time."elseecho":-) Creating inner dir modified time!"fiecho"After Time :$MODTIME"echo -e"Before Time :$INNERMKDIRTIME\n"sleep 2touch$TMPINNERFILEINNERFILETIME="$(stat -c %Y$TMPDIR)"if [["$INNERMKDIRTIME"=="$INNERFILETIME" ]];thenecho":-( Creating inner^2 file doesn't modify time."elseecho":-) Creating inner^2 file modified time!"fiecho"Before Time :$INNERMKDIRTIME"echo"After Time :$INNERFILETIME" Results: |
nicolas-grekas commentedJan 29, 2017
executive summary: do you see anything we can improve in DirectoryResource? |
robfrawley commentedJan 29, 2017
Just gave the class a once-over, and nothing specific jumps out to me. This PR does completely break the test suite, though (in line with what I mentioned above): |
robfrawley commentedJan 29, 2017
You could possibly change line 90 to something like if (($fileMTime =$file->getMTime()) >$timestamp) {returnfalse; }$newestMTime =max($fileMTime,$newestMTime); But with regard to this PR, you cannever break early with a return of |
nicolas-grekas commentedJan 29, 2017
Closing a discussed. Thanks for the PR anyway! |
SimonHeimberg commentedFeb 1, 2017
Hm, I wanted to break early when anything found is newer, but this should returnfalse of course, right. We can never quit early with true, but in the end true should be returned. |
This PR was squashed before being merged into the 2.7 branch (closes#21458).Discussion----------[Config] Early return for DirectoryResource| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | sure?| BC breaks? | no| Deprecations? | no| Tests pass? | no| Fixed tickets || Related PRs |#21440| License | MIT| Doc PR | n/aAlternate PR that implements an early return for `DirectoryResource` to increase the speed on large file sets. We can never return early with `true` without checking all assets within the resource, as the aforementioned referenced PR did; hence this PR takes the counter approach and returns `false` early where appropriate._Conversation about possible bug at#21458 (comment)Commits-------d5746ec fix directory resource considers same timestamp not fresh96107e2 return false early from directory resource
isFresh()quits as soon as a newer resource is found.