Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #50087 [Config] Improve GlobResource performance (clxmstaab)
This PR was merged into the 6.3 branch. Discussion ---------- [Config] Improve GlobResource performance | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Re-order conditions in GlobResource to prevent unnecessary file IO, which improves performance of the following test-script. put this script into the symfony/symfony project root and run it ```php <?php error_reporting(E_ALL); require __DIR__.'/vendor/autoload.php'; $glob = new \Symfony\Component\Config\Resource\GlobResource(__DIR__.'/src/', '/**/*.php', true); foreach($glob as $file) { echo $file->getRealPath()."\n"; } ``` I did a few measures and it consistently reports a 15-18% improvement ![grafik](https://user-images.githubusercontent.com/120441/233592449-2844bad8-6217-4ec9-a387-a83bd18a6269.png) https://blackfire.io/profiles/compare/647af42c-c4e5-495e-8f8d-1b77f61631dd/graph Commits ------- 172b1f7 [Config] Improve GlobResource performance
- Loading branch information