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

Composer 2 slow because it parses git branches #10064

Closed
ihor-sviziev opened this issue Aug 19, 2021 · 1 comment
Closed

Composer 2 slow because it parses git branches #10064

ihor-sviziev opened this issue Aug 19, 2021 · 1 comment
Labels
Milestone

Comments

@ihor-sviziev
Copy link

My composer.json:

{
    "name": "root/html",
    "type": "project",
    "authors": [
        {
            "name": "a",
            "email": "a@example.com"
        }
    ],
    "require": {}
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.1.5
PHP version: 7.4.22
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.1.1g FIPS  21 Apr 2020
cURL version: 7.61.1 libz 1.2.11 ssl OpenSSL/1.1.1g
zip: extension present, unzip present, 7-Zip not available

When I run this command: composer -V -vvv

time composer --version -vvv

I get the following output:

Reading ./composer.json (/var/www/html/composer.json)
Loading config file /home/www-data/.composer/auth.json
Loading config file ./composer.json (/var/www/html/composer.json)
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/var/www/html): git branch -a --no-color --no-abbrev -v
Executing command (/var/www/html): git rev-list 2.5-develop..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list 2.4-develop..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list 2.3.7-release..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list 2.3.7-Optimize_QuoteIdToMaskedQuoteId_model_and_fix_infinite_loop..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list 2.3.6-p1..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list 2.3..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.5-develop..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.4-develop..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.4..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3.7-release..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3.7-patch-33723..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3.7-patch-33706..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3.7-patch-33704..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3.7-patch-33664..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.3..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.2..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.1..replace-not-needed-polyfills
Executing command (/var/www/html): git rev-list remotes/origin/2.0..replace-not-needed-polyfills
Reading /home/www-data/.composer/composer.json
Loading config file /home/www-data/.composer/auth.json
Loading config file /home/www-data/.composer/composer.json (/home/www-data/.composer/composer.json)
Loading config file /home/www-data/.composer/auth.json
Reading /home/www-data/.composer/auth.json
Reading /home/www-data/.composer/vendor/composer/installed.json
Running 2.1.5 (2021-07-23 10:35:47) with PHP 7.4.22 on Linux / 5.4.72-microsoft-standard-WSL2
Composer version 2.1.5 2021-07-23 10:35:47

real    0m1.193s
user    0m1.011s
sys     0m0.431s

And I expected this to happen:
I expect that composer or composer --version will be near 0.1 second, similar to composer 1:
On composer1 this works way faster:

$ time composer1 --version -vvv
Reading ./composer.json
Loading config file /home/www-data/.composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/var/www/html): git branch -a --no-color --no-abbrev -v
Reading /home/www-data/.composer/composer.json
Loading config file /home/www-data/.composer/auth.json
Loading config file /home/www-data/.composer/composer.json
Loading config file /home/www-data/.composer/auth.json
Reading /home/www-data/.composer/auth.json
Reading /home/www-data/.composer/vendor/composer/installed.json
Running 1.10.22 (2021-04-27 13:10:45) with PHP 7.4.22 on Linux / 5.4.72-microsoft-standard-WSL2
Composer version 1.10.22 2021-04-27 13:10:45

real    0m0.102s
user    0m0.092s
sys     0m0.000s
@Seldaek Seldaek added this to the 2.1 milestone Aug 19, 2021
@Seldaek Seldaek added the Bug label Aug 19, 2021
@ihor-sviziev
Copy link
Author

@Seldaek, thx for the quick fix!

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

No branches or pull requests

2 participants