File tree Expand file tree Collapse file tree 11 files changed +269
-0
lines changed
Expand file tree Collapse file tree 11 files changed +269
-0
lines changed Original file line number Diff line number Diff line change 1+ /.idea /
2+ /vendor /
3+ /composer.lock
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace AbstractComponentConfiguration ;
6+
7+ abstract class AbstractComponentConfiguration
8+ {
9+ public static function getComponentType (): int
10+ {
11+ return 1 ;
12+ }
13+
14+ public static function getComponentName (): string
15+ {
16+ return 'PHP ' ;
17+ }
18+
19+ public static function getComponentSlug (): string
20+ {
21+ return 'php ' ;
22+ }
23+
24+ public static function isPhp56Enabled (): bool
25+ {
26+ return false ;
27+ }
28+
29+ public static function isPhp70Enabled (): bool
30+ {
31+ return false ;
32+ }
33+
34+ public static function isPhp71Enabled (): bool
35+ {
36+ return false ;
37+ }
38+
39+ public static function isPhp72Enabled (): bool
40+ {
41+ return false ;
42+ }
43+
44+ public static function isPhp73Enabled (): bool
45+ {
46+ return true ;
47+ }
48+
49+ public static function getBenchmarkUrl (): string
50+ {
51+ return 'index.php ' ;
52+ }
53+
54+ public static function getCoreDependencyName (): string
55+ {
56+ return 'php ' ;
57+ }
58+
59+ public static function getCoreDependencyMajorVersion (): int
60+ {
61+ return 7 ;
62+ }
63+
64+ public static function getCoreDependencyMinorVersion (): int
65+ {
66+ return 3 ;
67+ }
68+
69+ public static function getCoreDependencyPatchVersion (): int
70+ {
71+ return 0 ;
72+ }
73+
74+ public static function getBenchmarkType (): int
75+ {
76+ return 7 ;
77+ }
78+
79+ public static function getSourceCodeUrls (): array
80+ {
81+ return [
82+ 'serialization ' => 'https://github.com/phpbenchmarks/php/blob/php_7.3_serializer-hello-world/public/index.php '
83+ ];
84+ }
85+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ composer install --no-dev --classmap-authoritative --ansi
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80;
3+ server_name ____HOST____;
4+ root ____INSTALLATION_PATH____/public;
5+ location / {
6+ try_files $uri /index.php$is_args$args;
7+ }
8+ location ~ ^/(index).php(/|$) {
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+ error_log /var/log/nginx/benchmark_error.log;
16+ access_log /var/log/nginx/benchmark_access.log;
17+ }
Original file line number Diff line number Diff line change 1+ <p align =" center " >
2+ <img src =" http://www.phpbenchmarks.com/images/logo_github.png " >
3+ <br >
4+ <a href =" http://www.phpbenchmarks.com " target =" _blank " >www.phpbenchmarks.com</a >
5+ </p >
6+
7+ ## What is www.phpbenchmarks.com ?
8+
9+ You will find lot of benchmarks for PHP frameworks and template engines.
10+
11+ You can compare results between Apache Bench and Siege, and PHP 5.6 to 7.3.
12+
13+ ## What is this repository ?
14+
15+ It's benchmark common code for PHP benchmarks.
16+
17+ Switch branch to select your PHP major version and benchmark you want to see.
18+
19+ See all PHP benchmarked versions on [ phpbenchmarks/php] ( https://github.com/phpbenchmarks/php ) .
20+
21+ You can find how we benchmark on [ phpbenchmarks.com] ( http://www.phpbenchmarks.com/en/benchmark-protocol.html ) .
22+
23+ ## Benchmarks
24+
25+ You can find all PHP benchmarks results on [ phpbenchmarks.com] ( http://www.phpbenchmarks.com/en/benchmark/php.html ) .
26+
27+ Scores are too low ? Do not hesitate to create a pull request, and ask a new benchmark !
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " phpbenchmarks/php" ,
3+ "license" : " proprietary" ,
4+ "type" : " project" ,
5+ "require" : {
6+ "php" : " 7.3.*" ,
7+ "ext-json" : " *" ,
8+ "phpbenchmarks/benchmark-json-serialization-small-overload" : " 1.0.0"
9+ },
10+ "autoload" : {
11+ "psr-4" : {
12+ "Php73\\ BenchmarkJsonSerializationSmallOverload\\ " : " src/"
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Php73 \BenchmarkJsonSerializationSmallOverload \ObjectToSerializeFactory \JsonSerializableFactory ;
6+ use PhpBenchmarks \BenchmarkJsonSerializationSmallOverload \BenchmarkService ;
7+
8+ require __DIR__ . '/../vendor/autoload.php ' ;
9+
10+ $ benchmarkService = new BenchmarkService (new JsonSerializableFactory ());
11+
12+ if ($ benchmarkService ->isWriteToResponseBody ()) {
13+ echo json_encode ($ benchmarkService ->getDataToSerialize ());
14+ } else {
15+ json_encode ($ benchmarkService ->getDataToSerialize ());
16+ }
17+
18+ // require phpbenchmarks stats.php here when needed
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Php73 \BenchmarkJsonSerializationSmallOverload \ObjectToSerialize ;
6+
7+ use PhpBenchmarks \BenchmarkJsonSerializationSmallOverload \ObjectToSerialize \ObjectToSerialize ;
8+
9+ class JsonSerializableToSerialize extends ObjectToSerialize implements \JsonSerializable
10+ {
11+ /** @return array */
12+ public function jsonSerialize ()
13+ {
14+ return [
15+ 'property1 ' => $ this ->getProperty1 (),
16+ 'property2 ' => $ this ->getProperty2 (),
17+ 'property3 ' => $ this ->getProperty3 (),
18+ 'property4 ' => $ this ->getProperty4 (),
19+ 'property5 ' => $ this ->getProperty5 (),
20+ 'property6 ' => $ this ->getProperty6 (),
21+ 'property7 ' => $ this ->getProperty7 (),
22+ 'property8 ' => $ this ->getProperty8 (),
23+ 'property9 ' => $ this ->getProperty9 (),
24+ 'property10 ' => $ this ->getProperty10 ()
25+ ];
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments