Skip to content

Cache hot perfomance regression on 2.1.32 -> 2.2.6 #15011

Open

Description

@zeriyoshi

Bug report

details (Japanese): https://blog.colopl.dev/entry/2026/07/28/162136

TODO: phpstan bisect regression point checking

Currently memo:

  • Our repository has huge baseline profile, Maybe that's the reason.
  • Regenerate baseline on 2.1.32 -> 2.2.6 migration, Maybe that's the reason.

I'll reply if there are any updates.

Code snippet that reproduces the problem

No response

Expected output

faster than 2.1.32 on cache hot

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

PHPStan is an absolutely essential tool that supports the stable operation of our projects. We would like to express our deepest gratitude for providing this tool and for your commitment to incorporating aggressive improvements through PHPStan Turbo. Thank you!

Activity

  1. mergeable commented on Jul 28, 2026

    @mergeable

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

    It will most likely be closed after manual review.

  2. ondrejmirtes commented on Jul 28, 2026

    @ondrejmirtes
    Member

    Our repository has huge baseline profile, Maybe that's the reason.

    Have you tried switching to the PHP baseline format? https://phpstan.org/user-guide/baseline#php-baseline-format-instead-of-neon

  3. zeriyoshi commented on Jul 28, 2026

    @zeriyoshi
    Author

    @ondrejmirtes
    Yes. We used php style baseline format.

  4. SanderMuller commented on Jul 31, 2026

    @SanderMuller
    Contributor

    On whether Turbo is involved: your own table already rules it out. In the cache-hit rows the regression is fully present with Turbo OFF (2.1.32 14.6s vs 2.2.6 24.2s, +66%), and turning Turbo on shifts the warm number by only a few percent (24.2 off vs 24.9 / 23.5 on). Turbo's real win is cold-only (+21.8%). So this is a regression in stock PHPStan's warm path, not Turbo. That fits how Turbo works too: it mainly shadows analysis-engine classes, which a cache-hit run barely exercises.

    I tried to reproduce it and could not on a smaller corpus. On a doctrine/symfony codebase (~4.5k files) stock 2.2.6 cache-hit is about 2x faster than 2.1.32, not slower, and resultCache.php itself grew only ~1.1x between the two versions. So this is not a universal warm-path change; it is specific to larger setups like yours.

    The interesting part is the shape of your numbers: 2.2.6 is much faster cold (855 -> 436s, -49%) but slower warm (+66%). That is what you would expect if 2.2.6 does more per-run setup (there was quite a bit of new dependency and exported-node tracking in this window) which pays for itself during a full analysis but is the entire cost of a cache-hit run, where there is nothing left to analyse. That only becomes visible at your scale, which is why a small corpus shows the opposite.

    Fastest way to localize it without your codebase: run analyse -vvv cache-hit on both 2.1.32 and 2.2.6 and compare where the time goes (cache restore vs dependency processing vs the rest), plus the size of resultCache.php on each. If you can share that split it should point straight at the phase that grew. A git bisect across the result-cache commits between 2.1.32 and 2.2.6 would pin the exact commit if you have the appetite for it.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions