Skip to content

Commit 695d773

Browse files
committed
Templating small overload benchmark for PHP 8.0.0
0 parents  commit 695d773

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+21136
-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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.idea
2+
/vendor
3+
/composer.lock

.phpbenchmarks/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
component:
2+
slug: php
3+
benchmark:
4+
type: templating-small-overload
5+
relativeUrl: /
6+
sourceCode:
7+
entryPoint: public/index.php
8+
urls:
9+
template: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php'
10+
templatingLayout: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L6'
11+
templatingBlocks: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/templates/layout/layout_start.php#L31'
12+
templatingFunctions: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L8'
13+
templatingMacros: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L432'
14+
templatingEscapeStringHtml: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#856'
15+
templatingEscapeStringJs: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#2877'
16+
templatingVariables: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L5933'
17+
templatingOutputRaw: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L5933'
18+
templatingOutputUnknownVariables: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L6855'
19+
templatingOutputMethodCalls: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L7277'
20+
templatingIncludeTemplates: 'https://github.com/phpbenchmarks/php/tree/8.0.0_templating-small-overload_0/public/index.php#L9308'
21+
coreDependency:
22+
name: php
23+
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: 20 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: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
$sourceCodePath = __DIR__ . '/../../../';
4+
$files = [
5+
"$sourceCodePath/public/index.php",
6+
"$sourceCodePath/src/blocks.php",
7+
"$sourceCodePath/src/functions.php",
8+
"$sourceCodePath/src/macros.php",
9+
"$sourceCodePath/templates/layout_end.php",
10+
"$sourceCodePath/templates/layout_start.php",
11+
"$sourceCodePath/templates/templates/template1.php",
12+
"$sourceCodePath/templates/templates/template10.php",
13+
"$sourceCodePath/templates/templates/template11.php",
14+
"$sourceCodePath/templates/templates/template12.php",
15+
"$sourceCodePath/templates/templates/template13.php",
16+
"$sourceCodePath/templates/templates/template14.php",
17+
"$sourceCodePath/templates/templates/template15.php",
18+
"$sourceCodePath/templates/templates/template16.php",
19+
"$sourceCodePath/templates/templates/template17.php",
20+
"$sourceCodePath/templates/templates/template18.php",
21+
"$sourceCodePath/templates/templates/template19.php",
22+
"$sourceCodePath/templates/templates/template2.php",
23+
"$sourceCodePath/templates/templates/template20.php",
24+
"$sourceCodePath/templates/templates/template21.php",
25+
"$sourceCodePath/templates/templates/template22.php",
26+
"$sourceCodePath/templates/templates/template23.php",
27+
"$sourceCodePath/templates/templates/template24.php",
28+
"$sourceCodePath/templates/templates/template25.php",
29+
"$sourceCodePath/templates/templates/template26.php",
30+
"$sourceCodePath/templates/templates/template27.php",
31+
"$sourceCodePath/templates/templates/template28.php",
32+
"$sourceCodePath/templates/templates/template29.php",
33+
"$sourceCodePath/templates/templates/template3.php",
34+
"$sourceCodePath/templates/templates/template30.php",
35+
"$sourceCodePath/templates/templates/template31.php",
36+
"$sourceCodePath/templates/templates/template32.php",
37+
"$sourceCodePath/templates/templates/template33.php",
38+
"$sourceCodePath/templates/templates/template34.php",
39+
"$sourceCodePath/templates/templates/template35.php",
40+
"$sourceCodePath/templates/templates/template36.php",
41+
"$sourceCodePath/templates/templates/template37.php",
42+
"$sourceCodePath/templates/templates/template38.php",
43+
"$sourceCodePath/templates/templates/template39.php",
44+
"$sourceCodePath/templates/templates/template4.php",
45+
"$sourceCodePath/templates/templates/template40.php",
46+
"$sourceCodePath/templates/templates/template41.php",
47+
"$sourceCodePath/templates/templates/template42.php",
48+
"$sourceCodePath/templates/templates/template43.php",
49+
"$sourceCodePath/templates/templates/template44.php",
50+
"$sourceCodePath/templates/templates/template45.php",
51+
"$sourceCodePath/templates/templates/template46.php",
52+
"$sourceCodePath/templates/templates/template47.php",
53+
"$sourceCodePath/templates/templates/template48.php",
54+
"$sourceCodePath/templates/templates/template49.php",
55+
"$sourceCodePath/templates/templates/template5.php",
56+
"$sourceCodePath/templates/templates/template50.php",
57+
"$sourceCodePath/templates/templates/template6.php",
58+
"$sourceCodePath/templates/templates/template7.php",
59+
"$sourceCodePath/templates/templates/template8.php",
60+
"$sourceCodePath/templates/templates/template9.php",
61+
];
62+
63+
foreach ($files as $file) {
64+
if (is_readable($file) === false) {
65+
throw new \Exception('File "' . $file . '" is not readable.');
66+
}
67+
68+
opcache_compile_file($file);
69+
}

0 commit comments

Comments
 (0)