diff --git a/benchmark/runall.sh b/benchmark/runall.sh index 5f4c59f0a1b..aff3595104e 100755 --- a/benchmark/runall.sh +++ b/benchmark/runall.sh @@ -16,9 +16,9 @@ cargo bench --features stack_walking_tests -- --noplot # Run Trace Benchmarks cd .. make composer_tests_update -## Non-OPCache Benchmarks > tests/Benchmarks/results.csv +## Non-OPCache Benchmarks make benchmarks -cp tests/Benchmarks/tracer-bench-results.csv "$ARTIFACTS_DIR" -## OPCache Benchmarks > tests/Benchmarks/results-opcache.csv +cp tests/Benchmarks/reports/tracer-bench-results.csv "$ARTIFACTS_DIR" +## OPCache Benchmarks make benchmarks_opcache -cp tests/Benchmarks/tracer-bench-results-opcache.csv "$ARTIFACTS_DIR" +cp tests/Benchmarks/reports/tracer-bench-results-opcache.csv "$ARTIFACTS_DIR" diff --git a/tests/Benchmarks/README.md b/tests/Benchmarks/README.md index 680d5655ba9..d0e7fecdb7d 100644 --- a/tests/Benchmarks/README.md +++ b/tests/Benchmarks/README.md @@ -1 +1,45 @@ # Benchmarks + +## How to run benchmarks + +First refer to the [CONTRIBUTING.md](../../CONTRIBUTING.md) file to setup the environment. + +Then you can run the benchmarks with the following command from the root of the repository: + +```bash +make benchmarks +``` + +or if you want to run the benchmarks with OPcache enabled: + +```bash +make benchmarks_opcache +``` + +## How to add a new benchmark + +The benchmarks are located in the [tests/Benchmarks](.) folder and are written using [PHPBench](https://github.com/phpbench/phpbench). + +To add a new benchmark, create a new file under the [tests/Benchmarks](.) folder. In order for the benchmarks to be executed, the file name and class name must be suffixed with `Bench`, and each benchmark method must be prefixed with `bench`. + +Then you can write your benchmark using the [PHPBench](https://phpbench.readthedocs.io/en/latest/quick-start.html#create-a-benchmark) syntax. + +## How to run a single benchmark + +You can run a single benchmark with the following command: + +```bash +make benchmarks FILTER= +``` + +## How to run a single benchmark suite + +You can run a single benchmark suite with the following command: + +```bash +make benchmarks FILTER= +``` + +## Results + +The results of the benchmarks, as defined in the [phpbench.json](../phpbench.json) (resp. [phpbench-opcache.json](../phpbench-opcache.json)) file, are store in the [tests/Benchmarks/reports](./reports) folder. diff --git a/tests/Benchmarks/reports/.gitkeep b/tests/Benchmarks/reports/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/phpbench-opcache.json b/tests/phpbench-opcache.json index 1114ccb3d09..c80674e3f7c 100644 --- a/tests/phpbench-opcache.json +++ b/tests/phpbench-opcache.json @@ -24,7 +24,7 @@ "report.outputs": { "file": { "extends": "csv", - "file": "tests/Benchmarks/tracer-bench-results-opcache.csv", + "file": "tests/Benchmarks/reports/tracer-bench-results-opcache.csv", "delimiter": "," } } diff --git a/tests/phpbench.json b/tests/phpbench.json index 7629dba30a3..2fc223ab079 100644 --- a/tests/phpbench.json +++ b/tests/phpbench.json @@ -17,7 +17,7 @@ "report.outputs": { "file": { "extends": "csv", - "file": "tests/Benchmarks/tracer-bench-results.csv", + "file": "tests/Benchmarks/reports/tracer-bench-results.csv", "delimiter": "," } }