【发布时间】:2016-06-22 03:31:27
【问题描述】:
我一直在尝试测量我的一个 php 函数在使用结果缓存和不使用结果缓存时所花费的时间。
我遇到了麻烦,因为无论哪个在结果中先运行都会给更多时间,因此结果不是决定性的。
这是我的代码的一部分 -
/**
*
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// $this->withoutCache($output);
$this->withCache($output);
$this->withoutCache($output);
}
输出 -
RUN 1 -
withoutCache: 0.10952067375183
withCache: 0.077319145202637
RUN 2 -
withCache: 0.17031812667847
withoutCache: 0.042220115661621
我正在使用 symfony 框架,我正在测试使用缓存是否会在每次查询时对我有很大帮助。 Symfony 使用 Doctrine ORM 和 redis 作为结果缓存。
【问题讨论】:
标签: php symfony redis doctrine profiling