msd Backup hinzugefügt
This commit is contained in:
21
msd/vendor/desarrolla2/cache/tests/performance/Apc.php
vendored
Normal file
21
msd/vendor/desarrolla2/cache/tests/performance/Apc.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Cache package.
|
||||
*
|
||||
* Copyright (c) Daniel González
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Daniel González <daniel@desarrolla2.com>
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/../bootstrap.php';
|
||||
|
||||
use Desarrolla2\Cache\Cache;
|
||||
use Desarrolla2\Cache\Adapter\Apcu;
|
||||
|
||||
$cache = new Cache(new Apcu());
|
||||
|
||||
require_once __DIR__.'/common.php';
|
21
msd/vendor/desarrolla2/cache/tests/performance/File.php
vendored
Normal file
21
msd/vendor/desarrolla2/cache/tests/performance/File.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Cache package.
|
||||
*
|
||||
* Copyright (c) Daniel González
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Daniel González <daniel@desarrolla2.com>
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/../bootstrap.php';
|
||||
|
||||
use Desarrolla2\Cache\Cache;
|
||||
use Desarrolla2\Cache\Adapter\File;
|
||||
|
||||
$cache = new Cache(new File('/tmp'));
|
||||
|
||||
require_once __DIR__.'/common.php';
|
21
msd/vendor/desarrolla2/cache/tests/performance/Mongo.php
vendored
Normal file
21
msd/vendor/desarrolla2/cache/tests/performance/Mongo.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Cache package.
|
||||
*
|
||||
* Copyright (c) Daniel González
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Daniel González <daniel@desarrolla2.com>
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/../bootstrap.php';
|
||||
|
||||
use Desarrolla2\Cache\Cache;
|
||||
use Desarrolla2\Cache\Adapter\Mongo;
|
||||
|
||||
$cache = new Cache(new Mongo('mongodb://localhost:27017'));
|
||||
|
||||
require_once __DIR__.'/common.php';
|
21
msd/vendor/desarrolla2/cache/tests/performance/NoCache.php
vendored
Normal file
21
msd/vendor/desarrolla2/cache/tests/performance/NoCache.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Cache package.
|
||||
*
|
||||
* Copyright (c) Daniel González
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Daniel González <daniel@desarrolla2.com>
|
||||
*/
|
||||
|
||||
require_once __DIR__.'/../bootstrap.php';
|
||||
|
||||
use Desarrolla2\Cache\Cache;
|
||||
use Desarrolla2\Cache\Adapter\NotCache;
|
||||
|
||||
$cache = new Cache(new NotCache());
|
||||
|
||||
require_once __DIR__.'/common.php';
|
43
msd/vendor/desarrolla2/cache/tests/performance/common.php
vendored
Normal file
43
msd/vendor/desarrolla2/cache/tests/performance/common.php
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Cache package.
|
||||
*
|
||||
* Copyright (c) Daniel González
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Daniel González <daniel@desarrolla2.com>
|
||||
*/
|
||||
|
||||
|
||||
//build test data outside of timing loop
|
||||
$data = [];
|
||||
for ($i = 1; $i <= 10000; $i++) {
|
||||
$data[$i] = md5($i);
|
||||
}
|
||||
|
||||
$timer = new \Desarrolla2\Timer\Timer(new \Desarrolla2\Timer\Formatter\Human());
|
||||
for ($i = 1; $i <= 10000; $i++) {
|
||||
$cache->set($data[$i], $data[$i], 3600);
|
||||
}
|
||||
$timer->mark('10.000 set');
|
||||
for ($i = 1; $i <= 10000; $i++) {
|
||||
$cache->has($data[$i]);
|
||||
}
|
||||
$timer->mark('10.000 has');
|
||||
for ($i = 1; $i <= 10000; $i++) {
|
||||
$cache->get($data[$i]);
|
||||
}
|
||||
$timer->mark('10.000 get');
|
||||
for ($i = 1; $i <= 10000; $i++) {
|
||||
$cache->has($data[$i]);
|
||||
$cache->get($data[$i]);
|
||||
}
|
||||
$timer->mark('10.000 has+get combos');
|
||||
|
||||
$benchmarks = $timer->getAll();
|
||||
foreach ($benchmarks as $benchmark) {
|
||||
ld($benchmark);
|
||||
}
|
Reference in New Issue
Block a user