Skip to content

A review of the PHPUnit cache #6457

@theofidry

Description

@theofidry

I have some questions regarding the PHPUnit cache.

First of all: when does one benefit from it?

The only piece of documentation I can find about it is this:

Configure a directory where the PHPUnit test runner can cache data such as test results (required for reordering tests based on previous failures, for instance) or information about tested code as well as test code generated using static analysis (significantly improves performance of code coverage analysis, for instance).

What I understand:

  • if you use the defects order type, it will use it. By default it uses default, which unfortunately is not documented. At least here it is listed, but it does not say what it does, so you do not know if by default it is used or not.
  • Static analysis of some sorts may use it. Now, I know it is third-party so hard to have a reliable list, but maybe it would be good have a few listed? Personally I have no idea which kind uses it, and when.

Performance

Having a brief look at the cache directly, that is a lot of files. On Infection it is about 850 of them. I do not know if there is any extra cost for generating the cache, but I can only assume there's bound to be a cost for at least writing that many files.

I have no idea of the performance cost, I could not notice it on a naive benchmark I did with hyperfine.

That being said, if seems like a wasteful operation and if it proves to have a cost, would it make sense to have an option to disable it in the CI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/test-runnerCLI test runnertype/enhancementA new idea that should be implementedtype/performanceIssues related to resource consumption (time and memory)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions