Task #54095
closedOptimization of GeneralUtility::getFilesInDir()
100%
Description
- The current getFilesInDir calls strlen($extensionList) and strlen($excludePattern) in a while loop. These values are unchanging and should be calculated only once outside of the loop.
- From the data provided by the pathinfo($entry) call, only the extension is used. This can be written as: pathinfo($entry, PATHINFO_EXTENSION) which returns a simple string.
- The if condition: $prependPath ? $path . '/' : '' can be rewritten to use a variable variable.
But upon further inspection, it turns out that dropping the dir->read() in favor of glob() saves a lot of time.
Test results are here:We can save even more time by dropping the is_file() check from the glob() version. We search for files matching .ext. If no ext is given this will become *.. So false positives (directories instead of files) may be found if the searched directory contains directories ending in a dot followed by one of the extensions searched for or a dot (in case *.* is searched). So I'll submit a patch that does use the is_file() check.
Also, the md5 takes time . . . but is needed for backwards compatibility.
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Michiel Roos about 10 years ago
New tests: http://pastebin.com/Vwbpcbhk
Updated by Gerrit Code Review about 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Gerrit Code Review about 10 years ago
Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25768
Updated by Michiel Roos about 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8d67dfc1078a15617ec62588f95d8584dd0a7f14.