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'); +}