Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Still huge performance issues after 2.1.54 (and 2.1.55) with nested loops, mainly data providers #14674

@kristiaanvandeneynde

Description

@kristiaanvandeneynde

Bug report

I have an access module for Drupal which has very extensive unit tests, because access checks need to behave as expected in all possible combinations. Before the 2.1.54 release, my "heavy" test data provider would complete in seconds. After the release, it times out after 30 minutes on Drupal's infrastructure. On my powerful MacBook Pro, it does complete, but only after a few minutes.

What changed since 2.1.53 that is causing this? The fix in phpstan/phpstan-src#5614 was apparently not sufficient to return back to the excellent performance we had before.

The file in question is this: https://git.drupalcode.org/project/group/-/blob/4.0.x/tests/src/Unit/AccessControlTest.php?ref_type=heads#L542
As you can see, the data provider goes 13 levels of nesting deep. When I put an empty case 13 levels deep as demonstrated up to 8 levels in the test from phpstan/phpstan-src#5614, it already takes 50 seconds to complete on my powerful machine. So imagine actually putting data in the $cases, let alone a closure and you can see how this just does not complete.

I am now locking my module to phpstan 2.1.53 for the time being because the test in question really needs to test all these possible permutations. I would be thrilled if we could revert or fix whatever is causing this massive performance loss since 2.1.53 and am more than willing to test any fixes provided here.

P.S.: I tried removing the yield for a single return and that didn't change anything, still takes a long time to complete (and in that case even consumes more memory too).

Code snippet that reproduces the problem

No response

Expected output

Output is fine, it's just that it takes way too long compared to before.

Did PHPStan help you today? Did it make you happy in any way?

Yes, it makes my life as an open source maintainer so much easier.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions