Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First load VERY slow because of the translations #118

Open
maximehuran opened this issue May 24, 2022 · 0 comments
Open

First load VERY slow because of the translations #118

maximehuran opened this issue May 24, 2022 · 0 comments

Comments

@maximehuran
Copy link

maximehuran commented May 24, 2022

Preview Issue : Sylius/Sylius#10269
I didn't check if it was corrected but I don't want to loose it.

Sylius version affected: 1.2.4

Newer versions should be impacted.

Description

The first load of sylius is crazy slow.

Steps to reproduce

Put 22k files into your theme, in many directories (like a node_modules/).

Possible Solution

The function which is causing the "issue" is:

\Sylius\Bundle\ThemeBundle\Translation\Finder\TranslationFilesFinder::findTranslationFiles

    public function findTranslationFiles(string $path): array
    {
        $themeFiles = $this->getFiles($path);

        $translationsFiles = [];
        foreach ($themeFiles as $themeFile) {
            $themeFilepath = (string) $themeFile;

            if (!$this->isTranslationFile($themeFilepath)) {
                continue;
            }

            $translationsFiles[] = $themeFilepath;
        }

        return $translationsFiles;
    }

We found out that trying to find all the translation files in a node_modules/ directory can be very painful.

The discussion on Slack starts here: https://sylius-devs.slack.com/archives/C5K44R5GU/p1553722188005300

A related PR: Sylius/Sylius#9013

Some solutions:

  • Cache the translations during warmup
  • Add a depth to the finder
  • Detect node_modules/ because this is the main scenario…

The good thing is that we can implement all these solutions and it will be amazing!

Thank you 💪 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant