From 732a3001ec0bc6c5e18608eceb9f941fe480e2d2 Mon Sep 17 00:00:00 2001 From: Steevan Date: Sat, 18 May 2019 17:44:01 +0200 Subject: [PATCH] Small JSON serialization --- .gitignore | 2 + README.md | 37 +++++++++++++++++++ composer.json | 14 +++++++ .../ObjectToSerializeNormalizer.php | 31 ++++++++++++++++ src/Normalizer/OverloadNormalizer1.php | 18 +++++++++ src/Normalizer/OverloadNormalizer10.php | 18 +++++++++ src/Normalizer/OverloadNormalizer11.php | 18 +++++++++ src/Normalizer/OverloadNormalizer12.php | 18 +++++++++ src/Normalizer/OverloadNormalizer13.php | 18 +++++++++ src/Normalizer/OverloadNormalizer14.php | 18 +++++++++ src/Normalizer/OverloadNormalizer15.php | 18 +++++++++ src/Normalizer/OverloadNormalizer16.php | 18 +++++++++ src/Normalizer/OverloadNormalizer17.php | 18 +++++++++ src/Normalizer/OverloadNormalizer18.php | 18 +++++++++ src/Normalizer/OverloadNormalizer19.php | 18 +++++++++ src/Normalizer/OverloadNormalizer2.php | 18 +++++++++ src/Normalizer/OverloadNormalizer20.php | 18 +++++++++ src/Normalizer/OverloadNormalizer21.php | 18 +++++++++ src/Normalizer/OverloadNormalizer22.php | 18 +++++++++ src/Normalizer/OverloadNormalizer23.php | 18 +++++++++ src/Normalizer/OverloadNormalizer24.php | 18 +++++++++ src/Normalizer/OverloadNormalizer25.php | 18 +++++++++ src/Normalizer/OverloadNormalizer26.php | 18 +++++++++ src/Normalizer/OverloadNormalizer27.php | 18 +++++++++ src/Normalizer/OverloadNormalizer28.php | 18 +++++++++ src/Normalizer/OverloadNormalizer29.php | 18 +++++++++ src/Normalizer/OverloadNormalizer3.php | 18 +++++++++ src/Normalizer/OverloadNormalizer30.php | 18 +++++++++ src/Normalizer/OverloadNormalizer31.php | 18 +++++++++ src/Normalizer/OverloadNormalizer32.php | 18 +++++++++ src/Normalizer/OverloadNormalizer33.php | 18 +++++++++ src/Normalizer/OverloadNormalizer34.php | 18 +++++++++ src/Normalizer/OverloadNormalizer35.php | 18 +++++++++ src/Normalizer/OverloadNormalizer36.php | 18 +++++++++ src/Normalizer/OverloadNormalizer37.php | 18 +++++++++ src/Normalizer/OverloadNormalizer38.php | 18 +++++++++ src/Normalizer/OverloadNormalizer39.php | 18 +++++++++ src/Normalizer/OverloadNormalizer4.php | 18 +++++++++ src/Normalizer/OverloadNormalizer40.php | 18 +++++++++ src/Normalizer/OverloadNormalizer41.php | 18 +++++++++ src/Normalizer/OverloadNormalizer42.php | 18 +++++++++ src/Normalizer/OverloadNormalizer43.php | 18 +++++++++ src/Normalizer/OverloadNormalizer44.php | 18 +++++++++ src/Normalizer/OverloadNormalizer45.php | 18 +++++++++ src/Normalizer/OverloadNormalizer46.php | 18 +++++++++ src/Normalizer/OverloadNormalizer47.php | 18 +++++++++ src/Normalizer/OverloadNormalizer48.php | 18 +++++++++ src/Normalizer/OverloadNormalizer49.php | 18 +++++++++ src/Normalizer/OverloadNormalizer5.php | 18 +++++++++ src/Normalizer/OverloadNormalizer50.php | 18 +++++++++ src/Normalizer/OverloadNormalizer51.php | 18 +++++++++ src/Normalizer/OverloadNormalizer52.php | 18 +++++++++ src/Normalizer/OverloadNormalizer53.php | 18 +++++++++ src/Normalizer/OverloadNormalizer54.php | 18 +++++++++ src/Normalizer/OverloadNormalizer55.php | 18 +++++++++ src/Normalizer/OverloadNormalizer56.php | 18 +++++++++ src/Normalizer/OverloadNormalizer57.php | 18 +++++++++ src/Normalizer/OverloadNormalizer58.php | 18 +++++++++ src/Normalizer/OverloadNormalizer59.php | 18 +++++++++ src/Normalizer/OverloadNormalizer6.php | 18 +++++++++ src/Normalizer/OverloadNormalizer60.php | 18 +++++++++ src/Normalizer/OverloadNormalizer61.php | 18 +++++++++ src/Normalizer/OverloadNormalizer62.php | 18 +++++++++ src/Normalizer/OverloadNormalizer63.php | 18 +++++++++ src/Normalizer/OverloadNormalizer64.php | 18 +++++++++ src/Normalizer/OverloadNormalizer65.php | 18 +++++++++ src/Normalizer/OverloadNormalizer66.php | 18 +++++++++ src/Normalizer/OverloadNormalizer67.php | 18 +++++++++ src/Normalizer/OverloadNormalizer68.php | 18 +++++++++ src/Normalizer/OverloadNormalizer69.php | 18 +++++++++ src/Normalizer/OverloadNormalizer7.php | 18 +++++++++ src/Normalizer/OverloadNormalizer70.php | 18 +++++++++ src/Normalizer/OverloadNormalizer71.php | 18 +++++++++ src/Normalizer/OverloadNormalizer72.php | 18 +++++++++ src/Normalizer/OverloadNormalizer73.php | 18 +++++++++ src/Normalizer/OverloadNormalizer74.php | 18 +++++++++ src/Normalizer/OverloadNormalizer75.php | 18 +++++++++ src/Normalizer/OverloadNormalizer76.php | 18 +++++++++ src/Normalizer/OverloadNormalizer77.php | 18 +++++++++ src/Normalizer/OverloadNormalizer78.php | 18 +++++++++ src/Normalizer/OverloadNormalizer79.php | 18 +++++++++ src/Normalizer/OverloadNormalizer8.php | 18 +++++++++ src/Normalizer/OverloadNormalizer80.php | 18 +++++++++ src/Normalizer/OverloadNormalizer81.php | 18 +++++++++ src/Normalizer/OverloadNormalizer82.php | 18 +++++++++ src/Normalizer/OverloadNormalizer83.php | 18 +++++++++ src/Normalizer/OverloadNormalizer84.php | 18 +++++++++ src/Normalizer/OverloadNormalizer85.php | 18 +++++++++ src/Normalizer/OverloadNormalizer86.php | 18 +++++++++ src/Normalizer/OverloadNormalizer87.php | 18 +++++++++ src/Normalizer/OverloadNormalizer88.php | 18 +++++++++ src/Normalizer/OverloadNormalizer89.php | 18 +++++++++ src/Normalizer/OverloadNormalizer9.php | 18 +++++++++ src/Normalizer/OverloadNormalizer90.php | 18 +++++++++ src/Normalizer/OverloadNormalizer91.php | 18 +++++++++ src/Normalizer/OverloadNormalizer92.php | 18 +++++++++ src/Normalizer/OverloadNormalizer93.php | 18 +++++++++ src/Normalizer/OverloadNormalizer94.php | 18 +++++++++ src/Normalizer/OverloadNormalizer95.php | 18 +++++++++ src/Normalizer/OverloadNormalizer96.php | 18 +++++++++ src/Normalizer/OverloadNormalizer97.php | 18 +++++++++ src/Normalizer/OverloadNormalizer98.php | 18 +++++++++ src/Normalizer/OverloadNormalizer99.php | 18 +++++++++ src/benchmark.php | 22 +++++++++++ 104 files changed, 1888 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 composer.json create mode 100644 src/Normalizer/ObjectToSerializeNormalizer.php create mode 100644 src/Normalizer/OverloadNormalizer1.php create mode 100644 src/Normalizer/OverloadNormalizer10.php create mode 100644 src/Normalizer/OverloadNormalizer11.php create mode 100644 src/Normalizer/OverloadNormalizer12.php create mode 100644 src/Normalizer/OverloadNormalizer13.php create mode 100644 src/Normalizer/OverloadNormalizer14.php create mode 100644 src/Normalizer/OverloadNormalizer15.php create mode 100644 src/Normalizer/OverloadNormalizer16.php create mode 100644 src/Normalizer/OverloadNormalizer17.php create mode 100644 src/Normalizer/OverloadNormalizer18.php create mode 100644 src/Normalizer/OverloadNormalizer19.php create mode 100644 src/Normalizer/OverloadNormalizer2.php create mode 100644 src/Normalizer/OverloadNormalizer20.php create mode 100644 src/Normalizer/OverloadNormalizer21.php create mode 100644 src/Normalizer/OverloadNormalizer22.php create mode 100644 src/Normalizer/OverloadNormalizer23.php create mode 100644 src/Normalizer/OverloadNormalizer24.php create mode 100644 src/Normalizer/OverloadNormalizer25.php create mode 100644 src/Normalizer/OverloadNormalizer26.php create mode 100644 src/Normalizer/OverloadNormalizer27.php create mode 100644 src/Normalizer/OverloadNormalizer28.php create mode 100644 src/Normalizer/OverloadNormalizer29.php create mode 100644 src/Normalizer/OverloadNormalizer3.php create mode 100644 src/Normalizer/OverloadNormalizer30.php create mode 100644 src/Normalizer/OverloadNormalizer31.php create mode 100644 src/Normalizer/OverloadNormalizer32.php create mode 100644 src/Normalizer/OverloadNormalizer33.php create mode 100644 src/Normalizer/OverloadNormalizer34.php create mode 100644 src/Normalizer/OverloadNormalizer35.php create mode 100644 src/Normalizer/OverloadNormalizer36.php create mode 100644 src/Normalizer/OverloadNormalizer37.php create mode 100644 src/Normalizer/OverloadNormalizer38.php create mode 100644 src/Normalizer/OverloadNormalizer39.php create mode 100644 src/Normalizer/OverloadNormalizer4.php create mode 100644 src/Normalizer/OverloadNormalizer40.php create mode 100644 src/Normalizer/OverloadNormalizer41.php create mode 100644 src/Normalizer/OverloadNormalizer42.php create mode 100644 src/Normalizer/OverloadNormalizer43.php create mode 100644 src/Normalizer/OverloadNormalizer44.php create mode 100644 src/Normalizer/OverloadNormalizer45.php create mode 100644 src/Normalizer/OverloadNormalizer46.php create mode 100644 src/Normalizer/OverloadNormalizer47.php create mode 100644 src/Normalizer/OverloadNormalizer48.php create mode 100644 src/Normalizer/OverloadNormalizer49.php create mode 100644 src/Normalizer/OverloadNormalizer5.php create mode 100644 src/Normalizer/OverloadNormalizer50.php create mode 100644 src/Normalizer/OverloadNormalizer51.php create mode 100644 src/Normalizer/OverloadNormalizer52.php create mode 100644 src/Normalizer/OverloadNormalizer53.php create mode 100644 src/Normalizer/OverloadNormalizer54.php create mode 100644 src/Normalizer/OverloadNormalizer55.php create mode 100644 src/Normalizer/OverloadNormalizer56.php create mode 100644 src/Normalizer/OverloadNormalizer57.php create mode 100644 src/Normalizer/OverloadNormalizer58.php create mode 100644 src/Normalizer/OverloadNormalizer59.php create mode 100644 src/Normalizer/OverloadNormalizer6.php create mode 100644 src/Normalizer/OverloadNormalizer60.php create mode 100644 src/Normalizer/OverloadNormalizer61.php create mode 100644 src/Normalizer/OverloadNormalizer62.php create mode 100644 src/Normalizer/OverloadNormalizer63.php create mode 100644 src/Normalizer/OverloadNormalizer64.php create mode 100644 src/Normalizer/OverloadNormalizer65.php create mode 100644 src/Normalizer/OverloadNormalizer66.php create mode 100644 src/Normalizer/OverloadNormalizer67.php create mode 100644 src/Normalizer/OverloadNormalizer68.php create mode 100644 src/Normalizer/OverloadNormalizer69.php create mode 100644 src/Normalizer/OverloadNormalizer7.php create mode 100644 src/Normalizer/OverloadNormalizer70.php create mode 100644 src/Normalizer/OverloadNormalizer71.php create mode 100644 src/Normalizer/OverloadNormalizer72.php create mode 100644 src/Normalizer/OverloadNormalizer73.php create mode 100644 src/Normalizer/OverloadNormalizer74.php create mode 100644 src/Normalizer/OverloadNormalizer75.php create mode 100644 src/Normalizer/OverloadNormalizer76.php create mode 100644 src/Normalizer/OverloadNormalizer77.php create mode 100644 src/Normalizer/OverloadNormalizer78.php create mode 100644 src/Normalizer/OverloadNormalizer79.php create mode 100644 src/Normalizer/OverloadNormalizer8.php create mode 100644 src/Normalizer/OverloadNormalizer80.php create mode 100644 src/Normalizer/OverloadNormalizer81.php create mode 100644 src/Normalizer/OverloadNormalizer82.php create mode 100644 src/Normalizer/OverloadNormalizer83.php create mode 100644 src/Normalizer/OverloadNormalizer84.php create mode 100644 src/Normalizer/OverloadNormalizer85.php create mode 100644 src/Normalizer/OverloadNormalizer86.php create mode 100644 src/Normalizer/OverloadNormalizer87.php create mode 100644 src/Normalizer/OverloadNormalizer88.php create mode 100644 src/Normalizer/OverloadNormalizer89.php create mode 100644 src/Normalizer/OverloadNormalizer9.php create mode 100644 src/Normalizer/OverloadNormalizer90.php create mode 100644 src/Normalizer/OverloadNormalizer91.php create mode 100644 src/Normalizer/OverloadNormalizer92.php create mode 100644 src/Normalizer/OverloadNormalizer93.php create mode 100644 src/Normalizer/OverloadNormalizer94.php create mode 100644 src/Normalizer/OverloadNormalizer95.php create mode 100644 src/Normalizer/OverloadNormalizer96.php create mode 100644 src/Normalizer/OverloadNormalizer97.php create mode 100644 src/Normalizer/OverloadNormalizer98.php create mode 100644 src/Normalizer/OverloadNormalizer99.php create mode 100644 src/benchmark.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fbb073 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/vendor/ +/composer.lock diff --git a/README.md b/README.md new file mode 100644 index 0000000..9585582 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +

+ +
+ www.phpbenchmarks.com +

+ +## What is www.phpbenchmarks.com ? + +You will find lot of benchmarks for PHP frameworks and template engines. + +You can compare results between Apache Bench and Siege, and PHP 5.6 to 7.3. + +## What is this repository ? + +It's benchmark common code for Symfony serializer benchmarks. + +Switch branch to select your Symfony serializer major version and benchmark you want to see. + +See all Symfony serializer benchmarked versions on [phpbenchmarks/symfony-serializer](https://github.com/phpbenchmarks/symfony-serializer). + +You can find how we benchmark on [phpbenchmarks.com](http://phpbenchmarks.loc:8081/fr/documentation/benchmarking-protocol). + +## How versions works ? + +We do not follow semantic version for this repository. Here is an explanation about our versioning system: + +`X` related to Symfony serializer major version (`2` Symfony serializer ^2, `3` Symfony serializer ^3, `4` Symfony serializer ^4) + +`Y` benchmark type (`6` Serialization of Hello World, `7` Serialization to a small JSON, `8` Serialization to a big JSON) + +`Z` new version, not just bugfix and could contains BC + +## Benchmarks + +You can find all Symfony serializer benchmarks results on [phpbenchmarks.com](http://phpbenchmarks.com/en/benchmark/symfony-json-serializer/version). + +Scores are too low ? Do not hesitate to create a pull request, and [ask a new benchmark](http://phpbenchmarks.com/en/contact)! diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..a9f5825 --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "phpbenchmarks/symfony-serializer-common", + "license": "proprietary", + "require": { + "php": "^5.4||^7.0", + "symfony/serializer": "^2.1||^3.0||^4.0", + "phpbenchmarks/benchmark-json-serialization-small-overload": "1.0.0" + }, + "autoload": { + "psr-4": { + "PhpBenchmarks\\SymfonySerializerCommon\\": "src/" + } + } +} diff --git a/src/Normalizer/ObjectToSerializeNormalizer.php b/src/Normalizer/ObjectToSerializeNormalizer.php new file mode 100644 index 0000000..ad06429 --- /dev/null +++ b/src/Normalizer/ObjectToSerializeNormalizer.php @@ -0,0 +1,31 @@ + $object->getProperty1(), + 'property2' => $object->getProperty2(), + 'property3' => $object->getProperty3(), + 'property4' => $object->getProperty4(), + 'property5' => $object->getProperty5(), + 'property6' => $object->getProperty6(), + 'property7' => $object->getProperty7(), + 'property8' => $object->getProperty8(), + 'property9' => $object->getProperty9(), + 'property10' => $object->getProperty10() + ]; + } +} diff --git a/src/Normalizer/OverloadNormalizer1.php b/src/Normalizer/OverloadNormalizer1.php new file mode 100644 index 0000000..1c0d98c --- /dev/null +++ b/src/Normalizer/OverloadNormalizer1.php @@ -0,0 +1,18 @@ +isWriteToResponseBody()) { + echo $serializer->serialize($benchmarkService->getDataToSerialize(), 'json'); +} else { + $serializer->serialize($benchmarkService->getDataToSerialize(), 'json'); +}