-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
support linting multiple files at once using php -l
#10024
Comments
See https://bugs.php.net/40077. Might be doable and useful. |
Btw: I find it pretty suprising that it takes over 1 minute on a 10 core cpu windows laptop to lint the same project, which takes 15 seconds on a 2 core github action job (with 10 processes in parallel) |
I assume this is due to file system performance (which is slow on Windows, and multiple cores won't help with that). |
I am not that much into the details regarding windows internals. I am not at all a C expert though. thanks for all the feedback until now. |
Oh, right, creating new PHP processes is also very slow, especially if there are many DLLs to load (part of that problem is ASLR). We have been able to considerably speed up our test runs in CI by only loading the extensions which are really required for a single test case. Anyhow, this issue would be solved for the linting case, if we support multiple files to be linted at once. But there is still the bad file system performance, see https://bugs.php.net/80695. |
could you give me a few hints where I can start looking into it? I would start here
do you agree we would just allow to support a fixed number of additional arguments, or do you think we should support "n" arguments (no matter how much given)? |
Yes, these are the correct places (note, though, that the cgi and litespeed SAPIs also support linting). And see: Lines 967 to 974 in d6ac533
I think supporting an arbitrary amount of files makes the most sense, but that might get somewhat ugly, since currently reading from STDIN is supported, and we should not allow multiple files for other operations. |
@cmb69 Would be sensible to implement glob patterns here? I'd expect that in most cases you want to lint everything. |
I'd rather avoid that. Instead, users could do something like |
Hey Is it just me, or is it muuuuch slower to lint since PHP 8.2? I have a 128GB RAM server with NVMe, and a very good CPU, and until PHP 8.1, it used to be fast enough (~1 minute) to run the lint. Since I upgraded to PHP 8.2, it takes ~2 or 3 minutes to run the same lint across all files. Anyway - regarding running multiple lints, I know this isn't the answer to this Feature Request, but I've just found this: which can hopefully speed up the releases. |
…hp -l This is supported in both the CLI and CGI modes. For CLI this required little changes. For CGI, the tricky part was that the options parsing happens inside the loop. This means that options passed after the -l flag were previously simply ignored. As we now re-enter the loop we would parse the options again, and if they are handled but don't set the script name, then CGI will think you want to read from standard in. To keep the same "don't parse options" behaviour I simply wrapped the options handling inside an if.
…hp -l This is supported in both the CLI and CGI modes. For CLI this required little changes. For CGI, the tricky part was that the options parsing happens inside the loop. This means that options passed after the -l flag were previously simply ignored. As we now re-enter the loop we would parse the options again, and if they are handled but don't set the script name, then CGI will think you want to read from standard in. To keep the same "don't parse options" behaviour I simply wrapped the options handling inside an if.
…hp -l This is supported in both the CLI and CGI modes. For CLI this required little changes. For CGI, the tricky part was that the options parsing happens inside the loop. This means that options passed after the -l flag were previously simply ignored. As we now re-enter the loop we would parse the options again, and if they are handled but don't set the script name, then CGI will think you want to read from standard in. To keep the same "don't parse options" behaviour I simply wrapped the options handling inside an if.
Description
would it be possible to support passing multiple files to
php -l
, e.g.php -l file1.php file2.php file3.php
?my request is motivated by the fact the current linting tools are slow because of the overhead involved to lint every single file using a single process, so e.g.
proc_open
dominates the whole process.see this example blackfire profile, where I lint a project with 2890 files which takes 1min 14secs:
tested with on windows11 - but we see also unnecessary slowdown within github action jobs (not that big as in windows)
if we could e.g. lint 2 or 3 files at a time we could easily cut this processing time in half or even more.
The text was updated successfully, but these errors were encountered: