Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit d77f0d8

Browse files
committed
Added new benchmark
1 parent 7775534 commit d77f0d8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

benchmarks/BenchAsset/Bar.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace ZendBench\ServiceManager\BenchAsset;
3+
4+
class Bar
5+
{
6+
protected $options;
7+
8+
public function __construct($options = null)
9+
{
10+
$this->options = $options;
11+
}
12+
}

benchmarks/FetchNewServicesBench.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
66
use PhpBench\Benchmark\Metadata\Annotations\Revs;
77
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
8+
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
89
use Zend\ServiceManager\ServiceManager;
910

1011
/**
@@ -30,14 +31,20 @@ public function __construct()
3031
],
3132
'services' => [
3233
'service1' => new \stdClass(),
34+
'config' => [
35+
ConfigAbstractFactory::class => [
36+
BenchAsset\Bar::class => [],
37+
],
38+
],g
3339
],
3440
'aliases' => [
3541
'factoryAlias1' => 'factory1',
3642
'recursiveFactoryAlias1' => 'factoryAlias1',
3743
'recursiveFactoryAlias2' => 'recursiveFactoryAlias1',
3844
],
3945
'abstract_factories' => [
40-
BenchAsset\AbstractFactoryFoo::class
46+
BenchAsset\AbstractFactoryFoo::class,
47+
ConfigAbstractFactory::class,
4148
],
4249
]);
4350
}
@@ -145,4 +152,10 @@ public function benchBuildAbstractFactoryFoo()
145152

146153
$sm->build('foo');
147154
}
155+
156+
public function benchFetchConfigAbstractFactoryBar()
157+
{
158+
$sm = clone $this->sm;
159+
$sm->get(BenchAsset\Bar::class);
160+
}
148161
}

0 commit comments

Comments
 (0)