public function PerformanceTest::testCachedReadPerformanceWithFileCache

@group performance

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/PerformanceTest.php, line 40

Class

PerformanceTest

Namespace

Doctrine\Tests\Common\Annotations

Code

public function testCachedReadPerformanceWithFileCache() {
  $method = $this
    ->getMethod();

  // prime cache
  $reader = new FileCacheReader(new AnnotationReader(), sys_get_temp_dir());
  $reader
    ->getMethodAnnotations($method);
  $time = microtime(true);
  for ($i = 0, $c = 500; $i < $c; $i++) {
    $reader = new FileCacheReader(new AnnotationReader(), sys_get_temp_dir());
    $reader
      ->getMethodAnnotations($method);
    clearstatcache();
  }
  $time = microtime(true) - $time;
  $this
    ->printResults('cached reader (file)', $time, $c);
}