From 14cb5f338f8724f3fd17e44d7a9feedb3fb3a517 Mon Sep 17 00:00:00 2001 From: Dmitriy Fedorenko Date: Fri, 2 Feb 2018 10:05:07 +1000 Subject: [PATCH 1/3] DependencyInjection fixed docker-for-mac fs permance issue ticket_25999 --- src/Symfony/Component/Config/Resource/FileResource.php | 3 ++- .../Component/Config/Resource/ReflectionClassResource.php | 5 +++-- .../DependencyInjection/Config/AutowireServiceResource.php | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Config/Resource/FileResource.php b/src/Symfony/Component/Config/Resource/FileResource.php index 5d71d87918c8f..c21083ecce33f 100644 --- a/src/Symfony/Component/Config/Resource/FileResource.php +++ b/src/Symfony/Component/Config/Resource/FileResource.php @@ -60,7 +60,8 @@ public function getResource() */ public function isFresh($timestamp) { - return file_exists($this->resource) && @filemtime($this->resource) <= $timestamp; + $filemtime = @filemtime($this->resource); + return $filemtime && $filemtime <= $timestamp; } public function serialize() diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index a8e1f9611b99a..1371d7d6fe322 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -37,11 +37,12 @@ public function isFresh($timestamp) } foreach ($this->files as $file => $v) { - if (!file_exists($file)) { + $filemtime = @filemtime($file); + if (!$filemtime) { return false; } - if (@filemtime($file) > $timestamp) { + if ($filemtime > $timestamp) { return $this->hash === $this->computeHash(); } } diff --git a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php index 0eac93964b94c..2cd1cd1ece204 100644 --- a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php +++ b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php @@ -34,12 +34,13 @@ public function __construct($class, $path, array $autowiringMetadata) public function isFresh($timestamp) { - if (!file_exists($this->filePath)) { + $filemtime = @filemtime($this->filePath); + if (!$filemtime) { return false; } // has the file *not* been modified? Definitely fresh - if (@filemtime($this->filePath) <= $timestamp) { + if ($filemtime <= $timestamp) { return true; } From 2d3784c6be2cba2c93306ef0b4171c6d5d1d0069 Mon Sep 17 00:00:00 2001 From: Dmitriy Fedorenko Date: Fri, 2 Feb 2018 10:09:22 +1000 Subject: [PATCH 2/3] DependencyInjection fixed docker-for-mac fs permance issue ticket_25999 --- CHANGELOG-3.4.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-3.4.md b/CHANGELOG-3.4.md index 39bdf7acc9a6f..033dc4d684c6a 100644 --- a/CHANGELOG-3.4.md +++ b/CHANGELOG-3.4.md @@ -7,6 +7,10 @@ in 3.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.4.0...v3.4.1 +* 3.4.x (2018-xx-xx) + + * bug #25999 [DependencyInjection] Huge performance degradation of ReflectionClassResource and FileResource on big projects inside Docker For Mac + * 3.4.4 (2018-01-29) * bug #25932 Don't stop PSR-4 service discovery if a parent class is missing (derrabus) From ca18592131241998f6e9b81219b3618c80a592c5 Mon Sep 17 00:00:00 2001 From: Dmitriy Fedorenko Date: Fri, 2 Feb 2018 10:35:12 +1000 Subject: [PATCH 3/3] DependencyInjection fixed docker-for-mac fs permance issue ticket_25999 --- src/Symfony/Component/Config/Resource/FileResource.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Config/Resource/FileResource.php b/src/Symfony/Component/Config/Resource/FileResource.php index c21083ecce33f..cb6ad2e072694 100644 --- a/src/Symfony/Component/Config/Resource/FileResource.php +++ b/src/Symfony/Component/Config/Resource/FileResource.php @@ -61,6 +61,7 @@ public function getResource() public function isFresh($timestamp) { $filemtime = @filemtime($this->resource); + return $filemtime && $filemtime <= $timestamp; }