1111use JMS \Serializer \SerializerBuilder ;
1212use PhpBench \Attributes \BeforeMethods ;
1313use PhpBench \Attributes \Iterations ;
14+ use PhpBench \Attributes \RetryThreshold ;
1415use PhpBench \Attributes \Revs ;
1516use PhpBench \Attributes \Warmup ;
17+ use PHPUnit \Framework \Assert ;
1618use Symfony \Component \PropertyInfo \Extractor \PhpDocExtractor ;
1719use Symfony \Component \PropertyInfo \Extractor \PhpStanExtractor ;
1820use Symfony \Component \Serializer \Normalizer \ArrayDenormalizer ;
2729use TypeLang \Mapper \Platform \StandardPlatform ;
2830use TypeLang \Mapper \Tests \Bench \Stub \ExampleRequestDTO ;
2931
30- #[Revs(100 ), Warmup(5 ), Iterations(10 )]
32+ #[Revs(50 ), Warmup(5 ), Iterations(20 ), RetryThreshold( 5 )]
3133#[BeforeMethods('prepare ' )]
3234final class DenormalizationBench implements BenchInterface
3335{
@@ -70,16 +72,16 @@ public function prepare(): void
7072 $ this ->typeLangDocBlock = new Mapper (
7173 platform: new StandardPlatform (
7274 driver: new DocBlockDriver (
73- delegate: new ReflectionDriver ()
74- )
75+ delegate: new ReflectionDriver (),
76+ ),
7577 ),
7678 );
7779
7880 $ this ->typeLangAttributes = new Mapper (
7981 platform: new StandardPlatform (
8082 driver: new AttributeDriver (
81- delegate: new ReflectionDriver ()
82- )
83+ delegate: new ReflectionDriver (),
84+ ),
8385 ),
8486 );
8587
@@ -101,32 +103,32 @@ public function prepare(): void
101103 ]));
102104 }
103105
104- public function benchJms (): void
106+ public function benchJmsWithAttributes (): void
105107 {
106108 $ this ->jms ->fromArray (self ::PAYLOAD , ExampleRequestDTO::class);
107109 }
108110
109- public function benchValinor (): void
111+ public function benchValinorWithPhpStan (): void
110112 {
111113 $ this ->valinor ->map (ExampleRequestDTO::class, Source::array (self ::PAYLOAD ));
112114 }
113115
114- public function benchSymfonyPhpStan (): void
116+ public function benchSymfonyWithPhpStan (): void
115117 {
116118 $ this ->symfonyPhpStan ->denormalize (self ::PAYLOAD , ExampleRequestDTO::class);
117119 }
118120
119- public function benchSymfonyDocBlock (): void
121+ public function benchSymfonyWithDocBlock (): void
120122 {
121123 $ this ->symfonyDocBlock ->denormalize (self ::PAYLOAD , ExampleRequestDTO::class);
122124 }
123125
124- public function benchTypeLangDocBlock (): void
126+ public function benchTypeLangWithDocBlocks (): void
125127 {
126128 $ this ->typeLangDocBlock ->denormalize (self ::PAYLOAD , ExampleRequestDTO::class);
127129 }
128130
129- public function benchTypeLangAttributes (): void
131+ public function benchTypeLangWithAttributes (): void
130132 {
131133 $ this ->typeLangDocBlock ->denormalize (self ::PAYLOAD , ExampleRequestDTO::class);
132134 }
0 commit comments