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

Pint is painful to use in large projects #309

Open
mortenscheel opened this issue Nov 28, 2024 · 7 comments
Open

Pint is painful to use in large projects #309

mortenscheel opened this issue Nov 28, 2024 · 7 comments

Comments

@mortenscheel
Copy link

Pint Version

1.18.1

PHP Version

8.3.4

Description

I know that Pint's lack of parallelization has been discussed before in #93, #275 and #299 - but I would like to provide an example of how just how big this problem can be.

My team works on a very large modularized monolith Laravel app. Pint has to process 4698 php files.
On a new Macbook Pro with top specs, this takes at least 12 minutes, and that's when there's nothing it has to fix. When we used php-cs-fixer it took only a fraction of that time.
Of course it only takes this long when there are no cached results, but there are a lot of things that will cause the cache to be busted:

  • If the php-cs-fixer dependency is updated to a newer version.
  • Every time you rebuild your docker container, unless you configure Pint to store the cache inside the project folder.
  • If php is updated to a newer version, even a patch release. This happens rather frequently, especially if run in a docker container using a :latest base image.
  • If you run pint on your host machine and the existing cache was created in docker (or vice versa), because the results are cached using absolute paths.

Every time one of these things happen, we have to sit and wait for at least 12 minutes. That is more than just a minor annoyance, and I hope you'll agree that it's worth looking into.

Steps To Reproduce

  1. Have a Laravel project containing several thousand files.
  2. Run pint.
  3. Go for a walk.
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@ejunker
Copy link

ejunker commented Dec 6, 2024

12 minutes for 4698 files seems high. For reference, I have a project with 2993 files, and it only takes 56 seconds without using cache on a Macbook Pro with an M3 Pro CPU. I'm using the Laravel preset. Maybe running pint within Docker is causing it to run slower?

@bepsvpt
Copy link

bepsvpt commented Jan 2, 2025

@mortenscheel

Since the pull request (#325) has not been merged, you can try the following two methods to see if they fix the performance issue:

XDEBUG_MODE=off php vendor/bin/pint

or

php -d "xdebug.mode=off" vendor/bin/pint

@mortenscheel
Copy link
Author

@bepsvpt that was an easy 10x performance improvement 😂 Now it takes ~1 minute. I hope @taylorotwell reconsiders merging your PR.

@bepsvpt
Copy link

bepsvpt commented Jan 3, 2025

@mortenscheel

I'm glad to hear that the methods provided above were able to resolve the performance issue you encountered!

@Zen0x7
Copy link

Zen0x7 commented Jan 3, 2025

@mortenscheel just to know, which types of files takes more time? On my case #299, i had a couple of files with large arrays declared, just to understand the reason behind the slow performance.

@mortenscheel
Copy link
Author

@mortenscheel just to know, which types of files takes more time? On my case #299, i had a couple of files with large arrays declared, just to understand the reason behind the slow performance.

How do you find that out? All I can say is that the process was sluggish, but it didn't seem like it was only a couple of files that were slow.

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

No branches or pull requests

5 participants