public function PerformanceTest::testDocParsePerformance

@group performance

File

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

Class

PerformanceTest

Namespace

Doctrine\Tests\Common\Annotations

Code

public function testDocParsePerformance() {
  $imports = array(
    'ignorephpdoc' => 'Annotations\\Annotation\\IgnorePhpDoc',
    'ignoreannotation' => 'Annotations\\Annotation\\IgnoreAnnotation',
    'route' => 'Doctrine\\Tests\\Common\\Annotations\\Fixtures\\Annotation\\Route',
    'template' => 'Doctrine\\Tests\\Common\\Annotations\\Fixtures\\Annotation\\Template',
    '__NAMESPACE__' => 'Doctrine\\Tests\\Common\\Annotations\\Fixtures',
  );
  $ignored = array(
    'access',
    'author',
    'copyright',
    'deprecated',
    'example',
    'ignore',
    'internal',
    'link',
    'see',
    'since',
    'tutorial',
    'version',
    'package',
    'subpackage',
    'name',
    'global',
    'param',
    'return',
    'staticvar',
    'static',
    'var',
    'throws',
    'inheritdoc',
  );
  $method = $this
    ->getMethod();
  $methodComment = $method
    ->getDocComment();
  $classComment = $method
    ->getDeclaringClass()
    ->getDocComment();
  $time = microtime(true);
  for ($i = 0, $c = 200; $i < $c; $i++) {
    $parser = new DocParser();
    $parser
      ->setImports($imports);
    $parser
      ->setIgnoredAnnotationNames($ignored);
    $parser
      ->setIgnoreNotImportedAnnotations(true);
    $parser
      ->parse($methodComment);
    $parser
      ->parse($classComment);
  }
  $time = microtime(true) - $time;
  $this
    ->printResults('doc-parser', $time, $c);
}