Skip to content

Performance issue running coverage on Windows #1062

Open
@jrfnl

Description

@jrfnl
Q A
PHPUnit version 12.0.1
PHP version 8.4
Installation Method PHAR (but probably Composer to)

Summary

I'm seeing a significant performance slow-down when using PHPUnit 12 for path/branch coverage versus PHPUnit 11 when running on Windows (10).

When running just one test class (filtered down), I see a difference of 3 vs 50 seconds.

The slow-down appears to be at the start, before progress is being shown.

Current behavior

$ phpunit11 -c phpunit10.xml --filter AssertObjectNotEquals

PHPUnit 11.5.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.1 with Xdebug 3.4.1
Configuration: path/to/PHPUnit-Polyfills/phpunit10.xml

.........S.....S.......                                           23 / 23 (100%)

Time: 00:03.563, Memory: 376.00 MB

OK, but some tests were skipped!
Tests: 23, Assertions: 48, Skipped: 2.

Generating code coverage report in HTML format ... done [00:00.741]


Code Coverage Report Summary:
  Classes:  4.55% (1/22)
  Methods:  4.41% (6/136)
  Paths:    5.94% (6/101)
  Branches:    5.00% (6/120)
  Lines:    1.80% (10/555)
$ phpunit12 -c phpunit10.xml --filter AssertObjectNotEquals

PHPUnit 12.0.1 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.1 with Xdebug 3.4.1
Configuration: path/to/PHPUnit-Polyfills/phpunit10.xml

.........S.....S.......                                           23 / 23 (100%)

Time: 00:50.153, Memory: 370.00 MB

OK, but some tests were skipped!
Tests: 23, Assertions: 48, Skipped: 2.

Generating code coverage report in HTML format ... done [00:00.422]


Code Coverage Report Summary:
  Classes:  4.55% (1/22)
  Methods:  4.41% (6/136)
  Paths:    7.32% (6/82)
  Branches:    6.19% (6/97)
  Lines:    1.80% (10/555)

How to reproduce

If I run with --debug on, it looks like the test suite "hangs" between "Test Passed" and "Test Finished"

Test Runner Execution Started (23 tests)
Test Suite Started (path/to/PHPUnit-Polyfills/phpunit10.xml, 23 tests)
Test Suite Started (PHPUnitPolyfills, 23 tests)
Test Suite Started (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest, 21 tests)
Test Preparation Started (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest::testAssertObjectNotEquals)
Test Prepared (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest::testAssertObjectNotEquals)
Test Passed (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest::testAssertObjectNotEquals)

....hanging....

Test Finished (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest::testAssertObjectNotEquals)
Test Preparation Started (Yoast\PHPUnitPolyfills\Tests\Polyfills\AssertObjectNotEqualsTest::testAssertObjectNotEqualsCustomMethodName)

Reproducible via the https://github.com/Yoast/PHPUnit-Polyfills repo (though I'm still making some updates for PHPUnit 12 compatibility, which will be pulled soonish).

Expected behavior

No significant slow-down in performance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions