Skip to content

Commit

Permalink
REST API benchmark for PHP 8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steevanb committed Dec 1, 2020
0 parents commit c743bac
Show file tree
Hide file tree
Showing 27 changed files with 15,434 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '2.1'

jobs:
ValidateBenchmark:
docker:
- image: phpbenchmarks/benchmark-kit:4
working_directory: /var/www/benchmark
steps:
- checkout
- run:
name: entrypoint
command: entrypoint --nginx-as-service
- run:
name: "validate:benchmark"
command: "phpbenchkit validate:benchmark -vvv"

workflows:
version: '2.1'
BenchmarkKit:
jobs:
- ValidateBenchmark
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
/composer.lock
17 changes: 17 additions & 0 deletions .phpbenchmarks/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
component:
slug: php
benchmark:
type: rest-api
relativeUrl: /
sourceCode:
entryPoint: public/index.php
urls:
entryPoint: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php'
randomizeLanguageDispatchEvent: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L51'
randomizeLanguageEventListener: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/src/Translation/TranslationService.php#L11'
translations: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/translations/phpbenchmarks.en_GB.php'
translate: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L21'
serialize: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L58'
coreDependency:
name: php
version: 8.0.0
15 changes: 15 additions & 0 deletions .phpbenchmarks/nginx/vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen ____PORT____;
server_name ____HOST____;
root ____INSTALLATION_PATH____/____ENTRY_POINT_FILE_PATH____;
location / {
try_files $uri /____ENTRY_POINT_FILE_NAME____$is_args$args;
}
location ~ ____ENTRY_POINT_FILE_NAME____(/|$) {
fastcgi_pass unix:/run/php/____PHP_FPM_SOCK____;
fastcgi_split_path_info ^(.+.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
52 changes: 52 additions & 0 deletions .phpbenchmarks/php/8.0/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .phpbenchmarks/php/8.0/initBenchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

# add commands to initialize benchmark: clear cache and logs, warm up cache etc
composer install --no-dev --classmap-authoritative --ansi
31 changes: 31 additions & 0 deletions .phpbenchmarks/php/8.0/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; ----------------------------------------------------------------------------------------------------------------------
; This file will be added to PHP ini files loaded before benchmarking.
; Configure what you need here.
;
; /!\ Do NOT configure opcache.enable: it will be configured automatically.
; /!\ Do NOT configure opcache.preload and opcache.preload_user: it will be configured automatically. /!\
; ----------------------------------------------------------------------------------------------------------------------

; Examples of configuration you could change for your needs.

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
;opcache.max_accelerated_files=10000

; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
;opcache.save_comments=1

; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
;opcache.optimization_level=0x7FFFBFFF

; Allows exclusion of large files from being cached. By default all files
; are cached.
;opcache.max_file_size=0

; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0

; The OPcache shared memory storage size.
;opcache.memory_consumption=128
23 changes: 23 additions & 0 deletions .phpbenchmarks/php/8.0/preload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

$sourceCodePath = __DIR__ . '/../../../';
$files = [
"$sourceCodePath/public/index.php",
"$sourceCodePath/src/Translation/TranslationService.php",
"$sourceCodePath/translations/phpbenchmarks.en.php",
"$sourceCodePath/translations/phpbenchmarks.en_GB.php",
"$sourceCodePath/translations/phpbenchmarks.fr_FR.php",
"$sourceCodePath/vendor/autoload.php",
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/Comment.php",
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/CommentType.php",
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/Service.php",
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/User.php",
];

foreach ($files as $file) {
if (is_readable($file) === false) {
throw new \Exception('File "' . $file . '" is not readable.');
}

opcache_compile_file($file);
}
1 change: 1 addition & 0 deletions .phpbenchmarks/php/8.0/responseBody/responseBody.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]},{"id":1,"login":"phpbenchmarks","createdAt":"2017-10-30 18:03:00","translated":"aa_BB 1,000","comments":[{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}},{"id":1,"message":"http:\/\/www.php-benchmarks.com","translated":"aa_BB 2,000","type":{"id":1,"name":"Type","translated":"aa_BB 3,000"}}]}]
Loading

0 comments on commit c743bac

Please sign in to comment.