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

Run Pint analysis in Parallel #275

Closed
thbley opened this issue May 31, 2024 · 6 comments
Closed

Run Pint analysis in Parallel #275

thbley opened this issue May 31, 2024 · 6 comments

Comments

@thbley
Copy link

thbley commented May 31, 2024

Pint Version

v1.16.0

PHP Version

8.3.7

Description

Currently pint is always running in sequential mode. Running in parallel would be very nice!

Problem probably related to FixCode::execute() line 60 missing arguments for ParallelConfig and InputInterface.

Steps To Reproduce

Normal execute, use top to verify that only 1 php process is running instead of multiple.

@driesvints
Copy link
Member

Thanks for your proposal! Right now we don't have plans for this. Should you wish, you're free to attempt a PR yourself. Thanks!

@thbley
Copy link
Author

thbley commented Jun 3, 2024

Sorry to ask, but from the changelog, it looks like there are plans for parallel execution?

v1.16.0 Latest

[1.x] Enable Parallel Execution by @Jubeki in https://github.com/laravel/pint/pull/272

@IronSinew
Copy link

IronSinew commented Jun 11, 2024

@driesvints #272

Pint should be able to support running in parallel. I only see it running single-threaded as well.

@Jubeki
Copy link
Contributor

Jubeki commented Jun 12, 2024

As the Autor of the PR, I hoped, that pint would run in parallel without much of a hassle. But there could be more adjustments which need to be done, like something with building the binary. (This needs experimentation time and probably a good understanding about processes)

You are always free to try a PR, to make adjustments, so that pint actually runs in parallel. As this is only an improvement.

@lribi
Copy link

lribi commented Aug 12, 2024

Looked a bit into this and I think there are several issues.

As initially mentioned above, due to the direct usage of Runner, ParallelConfig and InputInterface need to be passed as arguments (otherwise it will fallback to sequential).

The bigger issue is the way how processes are created here https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/src/Runner/Parallel/ProcessFactory.php#L27

In a phar realpath will not work and it seems as a workaround a check based on argv and php-cs-fixer is used to define the binary to be executed in spawned processes.
Additionally the wrong assumption that several arguments are present in the input (when called through pint) will lead to issues.

I don't see a clean way to solve this using the current approach, without adjustments to PHP-CS-Fixer.

@mortenscheel
Copy link

In a project with ~5000 php files to analyze, it takes several minutes to run Pint. It feels like a major downgrade when switching from native php-cs-fixer.

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

6 participants