Skip to content

Commit

Permalink
Small JSON serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
steevanb committed May 18, 2019
0 parents commit 732a300
Show file tree
Hide file tree
Showing 104 changed files with 1,888 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor/
/composer.lock
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<p align="center">
<img src="http://www.phpbenchmarks.com/images/logo_github.png">
<br>
<a href="http://www.phpbenchmarks.com" target="_blank">www.phpbenchmarks.com</a>
</p>

## 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)!
14 changes: 14 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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/"
}
}
}
31 changes: 31 additions & 0 deletions src/Normalizer/ObjectToSerializeNormalizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use PhpBenchmarks\BenchmarkJsonSerializationSmallOverload\ObjectToSerialize\ObjectToSerialize;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class ObjectToSerializeNormalizer implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof ObjectToSerialize;
}

/** @param ObjectToSerialize $object */
public function normalize($object, $format = null, array $context = [])
{
return [
'property1' => $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()
];
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer1 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer10.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer10 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer11.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer11 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer12.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer12 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer13.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer13 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer14.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer14 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer15.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer15 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer16.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer16 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer17.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer17 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer18.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer18 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer19.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer19 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer2 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer20.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer20 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer21.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer21 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer22.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer22 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
18 changes: 18 additions & 0 deletions src/Normalizer/OverloadNormalizer23.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PhpBenchmarks\SymfonySerializerCommon\Normalizer;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class OverloadNormalizer23 implements NormalizerInterface
{
public function supportsNormalization($data, $format = null, array $context = [])
{
return $data instanceof UnknownObject;
}

public function normalize($object, $format = null, array $context = [])
{
throw new \Exception(__CLASS__ . '::' . __FUNCTION__ . ' should not be called.');
}
}
Loading

0 comments on commit 732a300

Please sign in to comment.