This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
149 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
engines: | ||
duplication: | ||
enabled: true | ||
config: | ||
languages: | ||
- php | ||
fixme: | ||
enabled: true | ||
phpcodesniffer: | ||
enabled: true | ||
phpmd: | ||
enabled: true | ||
ratings: | ||
paths: | ||
- "**.php" | ||
exclude_paths: | ||
- tests/ |
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,27 @@ | ||
language: php | ||
|
||
php: | ||
- '5.4' | ||
- '5.5' | ||
- '5.6' | ||
- '7.0' | ||
|
||
services: | ||
- redis-server | ||
|
||
before_install: echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | ||
|
||
install: | ||
- composer global require "fxp/composer-asset-plugin:^1.2.0" | ||
- composer require codeclimate/php-test-reporter --dev | ||
- composer install --no-progress --no-interaction | ||
|
||
script: | ||
- ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml | ||
|
||
addons: | ||
code_climate: | ||
repo_token: 255db28eb13c47dff54362135d879145fc97afff3eb91d97158608818bb4d1a9 | ||
|
||
after_script: | ||
- vendor/bin/test-reporter |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,58 @@ | ||
<?php | ||
|
||
include __DIR__ . "/bootstrap.php"; | ||
|
||
if (file_exists(__DIR__ . '/config-local.php')) { | ||
$param = include(__DIR__ . '/config-local.php'); | ||
} else { | ||
$param = include(__DIR__ . '/config.php'); | ||
} | ||
|
||
$phpRedisConfig = $param['class'] = 'dcb9\redis\Connection'; | ||
$yiiRedisConfig = $param['class'] = 'yii\redis\Connection'; | ||
|
||
$app = new \yii\console\Application([ | ||
'id' => 'test-performance-app', | ||
'basePath' => __DIR__, | ||
'vendorPath' => dirname(__DIR__) . '/vendor', | ||
'components' => [ | ||
'phpRedis' => $phpRedisConfig, | ||
'yiiRedis' => $yiiRedisConfig, | ||
], | ||
]); | ||
|
||
$count = 10000; | ||
echo "phpredis run SET $count times in"; | ||
$start = microtime(true); | ||
/* @var $phpRedis \dcb9\redis\Connection */ | ||
$phpRedis = Yii::$app->phpRedis; | ||
$phpRedis->open(); | ||
$phpRedis->flushdb(); | ||
for ($i = 0; $i < $count; $i++) { | ||
$phpRedis->set('php_redis_prefix' . $i, $i); | ||
} | ||
echo " " . ((microtime(true) - $start) * 1000) . " micro seconds.\n"; | ||
|
||
echo "yii redis run SET $count times in"; | ||
$start = microtime(true); | ||
/* @var $yiiRedis \yii\redis\Connection */ | ||
$yiiRedis = Yii::$app->yiiRedis; | ||
$yiiRedis->flushdb(); | ||
for ($i = 0; $i < $count; $i++) { | ||
$yiiRedis->set('yii_redis_prefix' . $i, $i); | ||
} | ||
echo " " . ((microtime(true) - $start) * 1000) . " micro seconds.\n"; | ||
|
||
echo "phpredis run GET $count times in"; | ||
$start = microtime(true); | ||
for ($i = 0; $i < $count; $i++) { | ||
$phpRedis->get('php_redis_prefix' . $i); | ||
} | ||
echo " " . ((microtime(true) - $start) * 1000) . " micro seconds.\n"; | ||
|
||
echo "yii redis run GET $count times in"; | ||
$start = microtime(true); | ||
for ($i = 0; $i < $count; $i++) { | ||
$yiiRedis->get('yii_redis_prefix' . $i); | ||
} | ||
echo " " . ((microtime(true) - $start) * 1000) . " micro seconds.\n"; |