#106822LanguagePackService::getExtensionLanguagePackDetails() causes major performance issues due to Finder usage and file counting
Description
In TYPO3 v12.4, we’ve identified a serious performance bottleneck in the method LanguagePackService::getExtensionLanguagePackDetails()
💥 Problem:
The current implementation performs expensive and repeated filesystem scans using Symfony’s Finder component. Specifically:
1. Unnecessary file counting
$files = $finder->files()->in($path . 'Resources/Private/Language/')->name('*.xlf');
if ($files->count() === 0) {
continue;
}
$files->count() iterates through all matching files just to check if there’s at least one.
This results in tens of thousands of unnecessary file operations when only a boolean check is needed.
✅ Suggestion: Replace with hasResults() (available since Symfony Finder 3.4):
if (!$files->hasResults()) {
continue;
}
2. Repeated Finder instantiation and recursion
The Symfony Finder is instantiated and executed once per extension.
With each call, RecursiveDirectoryIterator and related filesystem iterators are invoked.
In our profiling, this led to 134,000+ calls to RecursiveDirectoryIterator::current() across requests.
This is amplified when 20+ languages are configured in EXTCONF['lang']['availableLanguages'].
$packageManager = GeneralUtility::makeInstance(PackageManager::class);
$activePackages = $packageManager->getActivePackages();
foreach ($activePackages as $package) {
$finder = new Finder();
$files = $finder->files()->in($path . 'Resources/Private/Language/')->name('*.xlf');
}
📉 Result: Extremely high I/O and CPU cost even for extensions with no translation files.
🧪 Our setup (example):
'EXTCONF' => [
'lang' => [
'availableLanguages' => [
'ar', 'bg', 'cs', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'ko',
'lt', 'nl', 'pl', 'pt', 'pt_BR', 'ro', 'ru', 'sk', 'tr',
'uk', 'vi', 'zh', 'zh_HK',
],
],
],
📊 Observed impact:
Over 120,000 Finder iterations during a single languagePackDownload() cycle.
134,000+ calls to RecursiveDirectoryIterator::current() (measured via profiling tools).
Significant performance degradation during Extension Manager operations, language pack processing, and installs.
Recommendation:
Replace $files->count() === 0 with !$files->hasResults()
Avoid creating a new Finder instance per package — consider memorization or shared reuse if feasibleReviews 4
History 411
-
Stephan Großberndt changed description 07/29/25, 09:06
-
Stephan Großberndt commented 07/29/25, 10:27
-
Gerrit Code Review pushed patch set 1 for main to change 92822 status
NewUnder Review 02/12/26, 13:48 -
Gerrit Code Review pushed patch set 1 for main to change 93785 04/21/26, 15:07
-
Gerrit Code Review pushed patch set 2 for main to change 93785 04/22/26, 07:21
-
Gerrit Code Review pushed patch set 3 for main to change 93785 05/04/26, 19:12
-
Gerrit Code Review pushed patch set 4 for main to change 93785 05/04/26, 21:14
-
Gerrit Code Review pushed patch set 5 for main to change 93785 05/04/26, 21:15
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94337 06/05/26, 11:40
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % 06/05/26, 11:55Applied in changeset commit:7506b1027c65ad6ef9a264a8382a0b456dbed2d1.
-
Benni Mack changed status
ResolvedClosed 08/11/26, 08:46
- Using only one Finder instance makes the performance much worse
- Using
!$files->hasResults()improves the performance slightly- the actual problem which leads to so many file IO is a different one. There are a huge amount of unneeded calls to
getExtensionLanguagePackDetails()which iterates ALL extensions:77485: [FEATURE] Introduce event to prevent downloading of language packs introduced a “hack”:
languagePackDownloadis called fromLanguagePackCommandfor each extension for each language. Each of these calls leads to another call ofgetExtensionLanguagePackDetails()fetching all extensions all over again only to check the event. This is completely unnecessary here as theLanguagePackCommanddid already fetchgetExtensionLanguagePackDetails()as a base on which extensions to operate.The reason this hack was introduced here is the call of
languagePackDownload()fromMaintenanceController->languagePacksUpdatePackAction()where any extension key or iso could be sent in a request.The hack should be removed from
languagePackDownload.