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

Performance regression on array structures in 1.8.3 #7903

Closed
leongersen opened this issue Sep 2, 2022 · 4 comments
Closed

Performance regression on array structures in 1.8.3 #7903

leongersen opened this issue Sep 2, 2022 · 4 comments

Comments

@leongersen
Copy link
Contributor

Bug report

(the bot closed #7902 as I removed the bug report template, sorry).

I'm running into a performance regression between 1.8.1 and 1.8.3.

This file contains a lot of array structures, and is already fairly slow on 1.8.1. On 1.8.3, the time to analyse explodes.

bin/phpstan analyse <file>.php --debug -vvv

On 1.8.1:

--- consumed 70.5 MB, total 118.5 MB, took 33.14 s

On 1.8.3:

--- consumed 72.5 MB, total 122.5 MB, took 264.10 s

The file in question is full of business logic and references other classes, so I took the time to strip it down to something without dependencies.

Analysis of this stripped file in 1.8.3 shows a 10x slowdown compared to 1.8.1:

On 1.8.1:

--- consumed 18 MB, total 46 MB, took 6.40 s

On 1.8.3:

--- consumed 28 MB, total 78 MB, took 68.58 s

Code snippet that reproduces the problem

Stripped down file:
file.php.txt

Expected output

No slowdown.

@mergeable
Copy link

mergeable bot commented Sep 2, 2022

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@lolli42
Copy link

lolli42 commented Sep 2, 2022

Confirmed.

Without further debugging or in-depth knowledge, phpstan seems to be a two-fold thing: A cpu-parallelized "scan" part, and a single-cpu "compile" part or something like that? The latter is an order of magnitude slower since 1.8.3. This is significant for a bigger codebase, easily in the range of minutes.

reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this issue Sep 2, 2022
PHPStan fails with composer max installation due
changes in the detection. Raising the version to
corresponding version leads to abnormal performance
decrease. Thus not an option we can use.

This change pins phpstan to a fixed version to avoid
failing nightlies until the performance issue in the
PHPStan tool has been fixed.

See: phpstan/phpstan#7903

Used commands:

> composer req --dev "phpstan/phpstan":"1.8.2"

Resolves: #98253
Releases: main, 11.5
Change-Id: I38a31b87c36b9ae4c5915422dd3f09a6fca38b57
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75600
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this issue Sep 2, 2022
PHPStan fails with composer max installation due
changes in the detection. Raising the version to
corresponding version leads to abnormal performance
decrease. Thus not an option we can use.

This change pins phpstan to a fixed version to avoid
failing nightlies until the performance issue in the
PHPStan tool has been fixed.

See: phpstan/phpstan#7903

Used commands:

> composer req --dev "phpstan/phpstan":"1.8.2"

Resolves: #98253
Releases: main, 11.5
Change-Id: I38a31b87c36b9ae4c5915422dd3f09a6fca38b57
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75601
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
@ondrejmirtes
Copy link
Member

Fixed by: phpstan/phpstan-src@0cc87f3

@github-actions
Copy link

github-actions bot commented Oct 5, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants