Skip to content

Tags: Arzaroth/phpbench

Tags

1.2.3

Toggle 1.2.3's commit message
Update CL

1.2.2

Toggle 1.2.2's commit message
Update CL

1.2.1

Toggle 1.2.1's commit message
Update CHANGELOG version

1.2.0

Toggle 1.2.0's commit message
Update CHANGELOG

1.1.3

Toggle 1.1.3's commit message
Safely remove html output dir setting and improve HTML output docs (p…

…hpbench#930)

* Improved documentation for HTML output

* Safely remove dead setting

* Sanitise cwd references in snapshot test

* Updated docs and schema

* Add html example

* Update CL

1.1.2

Toggle 1.1.2's commit message
Update changelog

1.1.1

Toggle 1.1.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix/duplicate permutation runs when using abstract benchmarks (phpben…

…ch#919)

* Prevent registering `#[ParamProviders(...)]` multiple times when benchmark methods are inherited

In a test setup like following, PHPBench would run tests for one subject 4 times:

```php
abstract class MyGenericBench
{
    #[ParamProviders(['provideData'])]
    final public function benchSomething(): void { /* ... */ }
    abstract public function provideData(): array;
}

final class ConcreteBench extends MyGenericBench
{
    public function provideData(): array
    {
        return ['foo' => 1, 'bar' => 2];
    }
}
```

The executed tests datasets would look like following:

```
 * `foo` + `bar`
 * `bar` + `foo`
 * `foo` + `bar`
 * `bar` + `foo`
```

The reason for that is that the `AttributeDriver` processes subject metadata for
each class and for each method, and that happens multiple times in a hierarchy (because
inherited methods appear at each level of the hierarchy).

For example, a 3 level hierarchy would create 16 useless data provider permutations,
with the scenario above.

This patch fixes that by:

 * scanning benchmarks leaf-first (child classes being considered "concrete" benchmarks)
 * ignoring any duplicate subjects: if a subject has been found in a lower level of the inheritance, it is authoritative

* Subsitute sorted with ordered and fix CS

* Skip tests if PHP < 8

* Updated changelog

Co-authored-by: Marco Pivetta <ocramius@gmail.com>

1.1.0

Toggle 1.1.0's commit message
Updated changelog

1.0.4

Toggle 1.0.4's commit message
Updated CHANGELOG

1.0.3

Toggle 1.0.3's commit message
Updated CHANGELOG