GitXplorerGitXplorer
a

yac

public
13 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
fa62fb29bd12bc98bea77dd8d712b484a8681ef3

Merge pull request #1 from asm89/test/initialized-container-test

aasm89 committed 11 years ago
Unverified
fb7696117f2a1097cb713ba730c2f14447b6c099

Merge pull request #2 from danizord/docblocks

OOcramius committed 11 years ago
Unverified
41833059d366da8b6b6ee8ee9a4f1d7ff3c5add5

Add docblocks

ddanizord committed 11 years ago
Unverified
e8394e37dd31824cf482b00f7b766dc0c8bd4909

Adding yac performance results with initialized services

OOcramius committed 11 years ago
Unverified
2abf6071c014be86816d51c8e8c3fcf8355f9db4

Typo fix

OOcramius committed 11 years ago
Unverified
01e2e71f6dfac210240c25600b1f14a5d195a1f7

Performance tests + readme

aasm89 committed 11 years ago

README

The README file for this repository.

yac

Just remembered this gem from @crell at #tnphp: "Invent yet another container? You could call YAC, and shave it!" - igorwesome

Yet another container is yet another di container for PHP, inspired by Pimple and LazyMap. Basically blending the two together. When using it the LazyMap way it's very performant.

Defining parameters

$c = new Yac\Yac();
$c['env'] = 'dev';

Defining services

$c['session'] = function($c) { return new Session($c->env); };

Accessing parameters and services

$std = $c['std']; // pimple compatible
$std = $c->std;   // "fast" LazyMap way

Performance

Yac is much faster than Pimple!

 $ php -n ./vendor/bin/athletic -p ./tests/YacPerformance/ -b ./tests/bootstrap.php -f GroupedFormatter
YacPerformance\YacPerformanceEvent
  fetch_service-performance
    Method Name                                 Iterations    Average Time      Ops/s    Relative
    ------------------------------  ----------  ------------ --------------   ---------  ---------
    pimpleFetchService            : [Baseline] [100,000   ] [0.0000042015409] [238,007.91486]
    yacFetchServicePimpleStyle    :            [100,000   ] [0.0000032225394] [310,314.27956] [76.70%]
    yacFetchServiceLazyMapStyle   :            [100,000   ] [0.0000027879906] [358,681.27057] [66.36%]

  fetch_initialized_service-performance
    Method Name                                 Iterations    Average Time      Ops/s    Relative
    ------------------------------  ----------  ------------ --------------   ---------  ---------
    pimpleFetchInitializedService : [Baseline] [100,000   ] [0.0000010025978] [997,408.92228]
    yacFetchInitializedServicePimpleStyle:            [100,000   ] [0.0000007377648] [1,355,445.46456] [73.59%]
    yacFetchInitializedServiceLazyMapStyle:            [100,000 ] [0.0000002871366] [3,482,663.50475] [28.64%]

Known limitations

  • No parameter/service called __yac
  • All services are "shared", "prototype" services are not yet supported
  • ...