Skip to content

Commit c743bac

Browse files
committed
REST API benchmark for PHP 8.0.0
0 parents  commit c743bac

27 files changed

+15434
-0
lines changed

.circleci/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '2.1'
2+
3+
jobs:
4+
ValidateBenchmark:
5+
docker:
6+
- image: phpbenchmarks/benchmark-kit:4
7+
working_directory: /var/www/benchmark
8+
steps:
9+
- checkout
10+
- run:
11+
name: entrypoint
12+
command: entrypoint --nginx-as-service
13+
- run:
14+
name: "validate:benchmark"
15+
command: "phpbenchkit validate:benchmark -vvv"
16+
17+
workflows:
18+
version: '2.1'
19+
BenchmarkKit:
20+
jobs:
21+
- ValidateBenchmark

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
/composer.lock

.phpbenchmarks/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
component:
2+
slug: php
3+
benchmark:
4+
type: rest-api
5+
relativeUrl: /
6+
sourceCode:
7+
entryPoint: public/index.php
8+
urls:
9+
entryPoint: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php'
10+
randomizeLanguageDispatchEvent: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L51'
11+
randomizeLanguageEventListener: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/src/Translation/TranslationService.php#L11'
12+
translations: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/translations/phpbenchmarks.en_GB.php'
13+
translate: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L21'
14+
serialize: 'https://github.com/phpbenchmarks/php/tree/8.0.0_rest-api_0/public/index.php#L58'
15+
coreDependency:
16+
name: php
17+
version: 8.0.0

.phpbenchmarks/nginx/vhost.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen ____PORT____;
3+
server_name ____HOST____;
4+
root ____INSTALLATION_PATH____/____ENTRY_POINT_FILE_PATH____;
5+
location / {
6+
try_files $uri /____ENTRY_POINT_FILE_NAME____$is_args$args;
7+
}
8+
location ~ ____ENTRY_POINT_FILE_NAME____(/|$) {
9+
fastcgi_pass unix:/run/php/____PHP_FPM_SOCK____;
10+
fastcgi_split_path_info ^(.+.php)(/.*)$;
11+
include fastcgi_params;
12+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
13+
fastcgi_param HTTPS off;
14+
}
15+
}

.phpbenchmarks/php/8.0/composer.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# add commands to initialize benchmark: clear cache and logs, warm up cache etc
6+
composer install --no-dev --classmap-authoritative --ansi

.phpbenchmarks/php/8.0/php.ini

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; ----------------------------------------------------------------------------------------------------------------------
2+
; This file will be added to PHP ini files loaded before benchmarking.
3+
; Configure what you need here.
4+
;
5+
; /!\ Do NOT configure opcache.enable: it will be configured automatically.
6+
; /!\ Do NOT configure opcache.preload and opcache.preload_user: it will be configured automatically. /!\
7+
; ----------------------------------------------------------------------------------------------------------------------
8+
9+
; Examples of configuration you could change for your needs.
10+
11+
; The maximum number of keys (scripts) in the OPcache hash table.
12+
; Only numbers between 200 and 1000000 are allowed.
13+
;opcache.max_accelerated_files=10000
14+
15+
; If disabled, all PHPDoc comments are dropped from the code to reduce the
16+
; size of the optimized code.
17+
;opcache.save_comments=1
18+
19+
; A bitmask, where each bit enables or disables the appropriate OPcache
20+
; passes
21+
;opcache.optimization_level=0x7FFFBFFF
22+
23+
; Allows exclusion of large files from being cached. By default all files
24+
; are cached.
25+
;opcache.max_file_size=0
26+
27+
; Enables or disables opcode caching in shared memory.
28+
;opcache.file_cache_only=0
29+
30+
; The OPcache shared memory storage size.
31+
;opcache.memory_consumption=128

.phpbenchmarks/php/8.0/preload.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
$sourceCodePath = __DIR__ . '/../../../';
4+
$files = [
5+
"$sourceCodePath/public/index.php",
6+
"$sourceCodePath/src/Translation/TranslationService.php",
7+
"$sourceCodePath/translations/phpbenchmarks.en.php",
8+
"$sourceCodePath/translations/phpbenchmarks.en_GB.php",
9+
"$sourceCodePath/translations/phpbenchmarks.fr_FR.php",
10+
"$sourceCodePath/vendor/autoload.php",
11+
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/Comment.php",
12+
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/CommentType.php",
13+
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/Service.php",
14+
"$sourceCodePath/vendor/phpbenchmarks/benchmark-rest-data/User.php",
15+
];
16+
17+
foreach ($files as $file) {
18+
if (is_readable($file) === false) {
19+
throw new \Exception('File "' . $file . '" is not readable.');
20+
}
21+
22+
opcache_compile_file($file);
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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"}}]}]

0 commit comments

Comments
 (0)