-
Notifications
You must be signed in to change notification settings - Fork 396
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
Pre-commit Twig linting is slow, even when no .twig files have been staged for commit #3009
Comments
Ok, the slowness is coming from this line in TwigCommand.php:
Specifically it's the |
Here's the value of I don't really understand the process that this is trying to go through, but it seems like there's room for improvement if we're iterating over something that gigantic when I don't have any Twig files to lint in the first place. Any thoughts? As a side note, YAML linting completes immediately. |
Updated to reflect that it's slow whether running in Docker or not, because it takes a few seconds even when running locally when I don't have any Twig files staged for the current commit. It's slower in Docker but even outside of Docker it seems like the slowness is an issue. |
Here's some example verbose output from calling
|
I cannot reproduce this behavior. Are you able to provide steps to reproduce starting from a fresh install of BLT 9.2.x or 10.x? Specifically, I created a new BLT project and ran the following within DrupalVM (I don't have a Docker instance, but NFS performance in Vagrant should be similar):
|
I'm going to go ahead and close this in that case - seems to be a project-specific problem somehow. |
FWIW, I have this same problem. Also using Docker with NFS, and also identified the slow portion to be the call to The fact that it's scanning anything despite there not being any files that have a .yml or .yaml extension seems like a bug, though perhaps it's best added as a separate issue, as it doesn't make much sense to me that it should do anything in this case. The fileset that it scans is
And we have a lot of files in those directories, so I assume that's the slow down. |
Added #4451 as related |
My system information:
Output of
blt doctor
:When I run the pre-commit hook and I have no *.twig files staged for commit, it still seems to hang for about 10-15 seconds on each of those steps. I'd expect it to immediately recognize that there's nothing to do and move on.
I'm investigating the slowness but figured I'd drop this issue in the meantime in case anyone already knows what's going on here.
The text was updated successfully, but these errors were encountered: