Include max-recursion comparison in perf test
parent
42dc2c966d
commit
105f9bf813
|
@ -5,6 +5,7 @@ require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use LanguageServer\Index\Index;
|
use LanguageServer\Index\Index;
|
||||||
|
use LanguageServer\ParserKind;
|
||||||
use LanguageServer\ParserResourceFactory;
|
use LanguageServer\ParserResourceFactory;
|
||||||
use LanguageServer\PhpDocument;
|
use LanguageServer\PhpDocument;
|
||||||
use phpDocumentor\Reflection\DocBlockFactory;
|
use phpDocumentor\Reflection\DocBlockFactory;
|
||||||
|
@ -32,25 +33,50 @@ if (count($testProviderArray) === 0) {
|
||||||
throw new Exception("ERROR: Validation testsuite frameworks not found - run `git submodule update --init --recursive` to download.");
|
throw new Exception("ERROR: Validation testsuite frameworks not found - run `git submodule update --init --recursive` to download.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$start = microtime(true);
|
||||||
|
|
||||||
|
$documents = [];
|
||||||
foreach ($testProviderArray as $idx=>$testCaseFile) {
|
foreach ($testProviderArray as $idx=>$testCaseFile) {
|
||||||
if ($idx > 20) {
|
if ($idx > 100) {
|
||||||
exit();
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "$idx\n";
|
echo "$idx=>$testCaseFile\n";
|
||||||
|
|
||||||
$fileContents = file_get_contents($testCaseFile);
|
$fileContents = file_get_contents($testCaseFile);
|
||||||
|
|
||||||
$parser = ParserResourceFactory::getParser();
|
|
||||||
$docBlockFactory = DocBlockFactory::createInstance();
|
$docBlockFactory = DocBlockFactory::createInstance();
|
||||||
$index = new Index;
|
$index = new Index;
|
||||||
|
|
||||||
|
$parserKinds = [ParserKind::DIAGNOSTIC_PHP_PARSER, ParserKind::DIAGNOSTIC_TOLERANT_PHP_PARSER];
|
||||||
|
|
||||||
|
$maxRecursion = [];
|
||||||
|
foreach ($parserKinds as $kind) {
|
||||||
|
global $parserKind;
|
||||||
|
$parserKind = $kind;
|
||||||
|
|
||||||
$definitionResolver = ParserResourceFactory::getDefinitionResolver($index);
|
$definitionResolver = ParserResourceFactory::getDefinitionResolver($index);
|
||||||
|
$parser = ParserResourceFactory::getParser();
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$document = new PhpDocument($testCaseFile, $fileContents, $index, $parser, $docBlockFactory, $definitionResolver);
|
$document = new PhpDocument($testCaseFile, $fileContents, $index, $parser, $docBlockFactory, $definitionResolver);
|
||||||
|
if ($document->getStmts() === null) {
|
||||||
|
echo "AHHHHHHHHHH\n";
|
||||||
|
}
|
||||||
|
if (isset($maxRecursion[$testCaseFile]) && $maxRecursion[$testCaseFile] !== ($max = $definitionResolver::$maxRecursion)) {
|
||||||
|
$documents[] = "$testCaseFile\n => OLD: $maxRecursion[$testCaseFile], NEW: $max";
|
||||||
|
}
|
||||||
|
$maxRecursion[$testCaseFile] = $definitionResolver::$maxRecursion;
|
||||||
|
// $definitionResolver->printLogs();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo "AAAHH\n";
|
// echo "AAAHH\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "------------------------------\n";
|
||||||
|
var_dump($documents);
|
||||||
|
|
||||||
|
echo "Time: " . (microtime(true) - $start) . PHP_EOL;
|
||||||
|
|
Loading…
Reference in New Issue