Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from haampie/feature-bump-php-version-and-outda…
…te-dependencies Feature bump php version and fix outdated dependency
- Loading branch information
Showing
11 changed files
with
131 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/phpunit.xml | ||
/composer.lock | ||
/build/ | ||
/test/SymfonyIntegration/cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"bootstrap": "vendor/autoload.php", | ||
"path": "test/Performance" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php namespace BroadwaySerialization\Test\Performance; | ||
|
||
use BroadwaySerialization\Hydration\HydrateUsingReflection; | ||
use BroadwaySerialization\Hydration\HydrateUsingReflectionFaster; | ||
use BroadwaySerialization\Reconstitution\ReconstituteUsingInstantiatorAndHydrator; | ||
use BroadwaySerialization\Reconstitution\Reconstitution; | ||
use Doctrine\Instantiator\Instantiator; | ||
|
||
class ReconstitutionBench | ||
{ | ||
private $deserializationData = [ | ||
'stringProperty' => 'foo', | ||
'integerProperty' => 20, | ||
'nullProperty' => null, | ||
'arrayProperty' => ['foo' => 'bar', 'bar' => 'baz'], | ||
'objectProperty' => [ | ||
'foo' => 'foo', | ||
], | ||
'objectsProperty' => [ | ||
[ | ||
'foo' => 'bar', | ||
], | ||
[ | ||
'foo' => 'baz', | ||
], | ||
] | ||
]; | ||
|
||
public function setup() | ||
{ | ||
$reconstitute = new ReconstituteUsingInstantiatorAndHydrator(new Instantiator(), new HydrateUsingReflection()); | ||
|
||
// test run, for calibration | ||
$reconstitute->objectFrom(SerializableClassUsingTrait::class, []); | ||
$reconstitute->objectFrom(SomeOtherSerializableClassUsingTrait::class, []); | ||
|
||
Reconstitution::reconstituteUsing($reconstitute); | ||
} | ||
|
||
/** | ||
* @Warmup(10) | ||
* @Revs(100000) | ||
* @Groups({"traditional"}) | ||
*/ | ||
public function benchDeserializeTraditionalObject() | ||
{ | ||
TraditionalSerializableClass::deserialize($this->deserializationData); | ||
} | ||
|
||
/** | ||
* @Warmup(10) | ||
* @Revs(100000) | ||
* @Groups({"trait"}) | ||
* @BeforeMethods({"setup"}) | ||
*/ | ||
public function benchDeserializeObjectUsingTrait() | ||
{ | ||
SerializableClassUsingTrait::deserialize($this->deserializationData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php namespace BroadwaySerialization\Test\Performance; | ||
|
||
use Broadway\Serializer\SerializableInterface; | ||
use BroadwaySerialization\Hydration\HydrateUsingReflection; | ||
use BroadwaySerialization\Hydration\HydrateUsingReflectionFaster; | ||
use BroadwaySerialization\Reconstitution\ReconstituteUsingInstantiatorAndHydrator; | ||
use BroadwaySerialization\Reconstitution\Reconstitution; | ||
use Doctrine\Instantiator\Instantiator; | ||
|
||
class BenchSerialization | ||
{ | ||
/** | ||
* @var SerializableInterface | ||
*/ | ||
private $traditionalSerializableClass; | ||
|
||
/** | ||
* @var SerializableInterface | ||
*/ | ||
private $serializableClassUsingTrait; | ||
|
||
public function setup() | ||
{ | ||
$this->traditionalSerializableClass = new TraditionalSerializableClass(); | ||
$this->serializableClassUsingTrait = new SerializableClassUsingTrait(); | ||
} | ||
|
||
public function setupReconstitute() | ||
{ | ||
$reconstitute = new ReconstituteUsingInstantiatorAndHydrator(new Instantiator(), new HydrateUsingReflection()); | ||
|
||
// test run, for calibration | ||
$reconstitute->objectFrom(SerializableClassUsingTrait::class, []); | ||
$reconstitute->objectFrom(SomeOtherSerializableClassUsingTrait::class, []); | ||
|
||
Reconstitution::reconstituteUsing($reconstitute); | ||
} | ||
|
||
/** | ||
* @Warmup(10) | ||
* @Revs(100000) | ||
* @Groups({"traditional"}) | ||
* @BeforeMethods({"setup"}) | ||
*/ | ||
public function benchSerializeObjectWithOnlyScalarProperties() | ||
{ | ||
$this->traditionalSerializableClass->serialize(); | ||
} | ||
|
||
/** | ||
* @Warmup(10) | ||
* @Revs(100000) | ||
* @Groups({"trait"}) | ||
* @BeforeMethods({"setup","setupReconstitute"}) | ||
*/ | ||
public function benchSerializeObjectWithOnlyScalarPropertiesWithTrait() | ||
{ | ||
$this->serializableClassUsingTrait->serialize(); | ||
} | ||
} |
Oops, something went wrong.