Skip to content

Commit

Permalink
Merge pull request #159 from patchlevel/benchmark
Browse files Browse the repository at this point in the history
add benchmarks
  • Loading branch information
DavidBadura authored Jan 4, 2022
2 parents e5dd834 + 73ede63 commit f74dc8a
Show file tree
Hide file tree
Showing 21 changed files with 993 additions and 19 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Benchmark"

on:
pull_request:
push:
branches:
- "[0-9]+.[0-9]+.x"

jobs:
phpbench:
name: "Benchmark"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.0"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
extensions: pdo_sqlite

- uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}

- name: "PHPStan"
run: "vendor/bin/phpbench run tests/Benchmark --report=default"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ static: psalm phpstan phpcs-check

test: phpunit ## run tests

.PHONY: benchmark
benchmark: vendor ## run benchmarks
vendor/bin/phpbench run tests/Benchmark --report=default

.PHONY: dev
dev: static test ## run dev tools
29 changes: 26 additions & 3 deletions baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,32 @@
<code>$bucket-&gt;event() instanceof $class</code>
</RedundantConditionGivenDocblockType>
</file>
<file src="tests/Benchmark/BasicImplementation/Aggregate/Profile.php">
<MoreSpecificImplementedParamType occurrences="1">
<code>$payload</code>
</MoreSpecificImplementedParamType>
</file>
<file src="tests/Benchmark/LoadEventsBench.php">
<MissingConstructor occurrences="2">
<code>$bus</code>
<code>$store</code>
</MissingConstructor>
</file>
<file src="tests/Benchmark/LoadEventsWithSnapshotsBench.php">
<MissingConstructor occurrences="3">
<code>$bus</code>
<code>$snapshotStore</code>
<code>$store</code>
</MissingConstructor>
</file>
<file src="tests/Benchmark/WriteEventsBench.php">
<MissingConstructor occurrences="4">
<code>$bus</code>
<code>$profile</code>
<code>$repository</code>
<code>$store</code>
</MissingConstructor>
</file>
<file src="tests/Integration/BasicImplementation/Aggregate/Profile.php">
<MoreSpecificImplementedParamType occurrences="1">
<code>$payload</code>
Expand All @@ -29,9 +55,6 @@
</MissingClosureParamType>
</file>
<file src="tests/Unit/Fixture/ProfileWithSnapshot.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>SnapshotableAggregateRoot</code>
</LessSpecificImplementedReturnType>
<MoreSpecificImplementedParamType occurrences="1">
<code>$payload</code>
</MoreSpecificImplementedParamType>
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"infection/infection": "^0.21.5",
"patchlevel/coding-standard": "^1.1.1",
"patchlevel/event-sourcing-psalm-plugin": "^1.0.0",
"phpbench/phpbench": "^1.2",
"phpspec/prophecy-phpunit": "^2.0.1",
"phpstan/phpstan": "^1.2.0",
"phpunit/phpunit": "^9.5.10",
Expand Down
Loading

0 comments on commit f74dc8a

Please sign in to comment.